mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-01-30 14:55:07 +01:00
Update copycat occlusion
This commit is contained in:
parent
e03c191edd
commit
37b49a2c45
2 changed files with 11 additions and 7 deletions
|
@ -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()
|
||||||
|
|
|
@ -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) {
|
Loading…
Reference in a new issue