Update copycat occlusion

This commit is contained in:
IThundxr 2024-08-27 11:05:59 -04:00
parent e03c191edd
commit 37b49a2c45
Failed to generate hash of commit
2 changed files with 11 additions and 7 deletions

View file

@ -9,7 +9,7 @@ import com.simibubi.create.foundation.placement.IPlacementHelper;
import com.simibubi.create.foundation.placement.PlacementHelpers; import com.simibubi.create.foundation.placement.PlacementHelpers;
import com.simibubi.create.foundation.placement.PlacementOffset; import com.simibubi.create.foundation.placement.PlacementOffset;
import com.simibubi.create.foundation.utility.worldWrappers.OcclusionTestWorld; import com.simibubi.create.foundation.utility.worldWrappers.OcclusionTestLevel;
import net.minecraft.MethodsReturnNonnullByDefault; import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@ -188,12 +188,16 @@ public class CopycatPanelBlock extends WaterloggedCopycatBlock {
if (material.skipRendering(otherMaterial, dir.getOpposite())) if (material.skipRendering(otherMaterial, dir.getOpposite()))
return isOccluded(state, neighborState, dir.getOpposite()); return isOccluded(state, neighborState, dir.getOpposite());
OcclusionTestWorld occlusionTestWorld = new OcclusionTestWorld(); OcclusionTestLevel occlusionTestLevel = new OcclusionTestLevel();
occlusionTestWorld.setBlock(pos, material); occlusionTestLevel.setBlock(pos, material);
occlusionTestWorld.setBlock(otherPos, otherMaterial); occlusionTestLevel.setBlock(otherPos, otherMaterial);
if (material.isSolidRender(occlusionTestWorld, pos) && otherMaterial.isSolidRender(occlusionTestWorld, otherPos)) if (material.isSolidRender(occlusionTestLevel, pos) && otherMaterial.isSolidRender(occlusionTestLevel, otherPos))
if(!Block.shouldRenderFace(otherMaterial, occlusionTestWorld, pos, dir.getOpposite(), otherPos)) if(!Block.shouldRenderFace(otherMaterial, occlusionTestLevel, pos, dir.getOpposite(), otherPos)) {
occlusionTestLevel.clear();
return isOccluded(state, neighborState, dir.getOpposite()); return isOccluded(state, neighborState, dir.getOpposite());
}
occlusionTestLevel.clear();
} }
return state.getValue(FACING) == dir.getOpposite() return state.getValue(FACING) == dir.getOpposite()

View file

@ -20,7 +20,7 @@ import java.util.Map;
*/ */
@ParametersAreNonnullByDefault @ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault @MethodsReturnNonnullByDefault
public class OcclusionTestWorld implements BlockGetter { public class OcclusionTestLevel implements BlockGetter {
private final Map<BlockPos, BlockState> blocks = new HashMap<>(); private final Map<BlockPos, BlockState> blocks = new HashMap<>();
public void setBlock(BlockPos pos, BlockState state) { public void setBlock(BlockPos pos, BlockState state) {