From 6422310453fe4029a409adf19d3bac6bfb3ea589 Mon Sep 17 00:00:00 2001 From: Wyn Price Date: Tue, 22 Oct 2019 23:29:27 +0100 Subject: [PATCH] Fixed forge rendering pipeline and shape based light occulsion. (#6178) --- .../client/model/pipeline/BlockInfo.java | 10 +++++++++- .../minecraftforge/common/extensions/IForgeBlock.java | 3 +++ .../common/extensions/IForgeBlockState.java | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java b/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java index 9f2b8fab5..3f01f5a13 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java @@ -21,10 +21,12 @@ package net.minecraftforge.client.model.pipeline; import net.minecraft.block.Block; import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; import net.minecraft.client.renderer.color.BlockColors; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.world.IEnviromentBlockReader; public class BlockInfo @@ -134,7 +136,13 @@ public class BlockInfo } for(Direction side : SIDES) { - if(!state.doesSideBlockRendering(world, blockPos, side)) + BlockPos pos = blockPos.offset(side); + BlockState state = world.getBlockState(pos); + + BlockState thisStateShape = this.state.isSolid() && this.state.func_215691_g() ? this.state : Blocks.AIR.getDefaultState(); + BlockState otherStateShape = state.isSolid() && state.func_215691_g() ? state : Blocks.AIR.getDefaultState(); + + if(state.getOpacity(world, blockPos) == 15 || VoxelShapes.func_223416_b(thisStateShape.func_215702_a(world, blockPos, side), otherStateShape.func_215702_a(world, pos, side.getOpposite()))) { int x = side.getXOffset() + 1; int y = side.getYOffset() + 1; diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java b/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java index 85d90fb37..2c1292f5d 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeBlock.java @@ -136,6 +136,7 @@ public interface IForgeBlock return false; } + //TODO: remove in 1.15 /** * Check if the face of a block should block rendering. * @@ -147,7 +148,9 @@ public interface IForgeBlock * @param pos Block position in world * @param face The side to check * @return True if the block is opaque on the specified side. + * @deprecated This is no longer used for rendering logic. */ + @Deprecated default boolean doesSideBlockRendering(BlockState state, IEnviromentBlockReader world, BlockPos pos, Direction face) { return state.isOpaqueCube(world, pos); diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java b/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java index 5741a7738..3cb151969 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java @@ -102,6 +102,7 @@ public interface IForgeBlockState return getBlockState().getBlock().isLadder(getBlockState(), world, pos, entity); } + //TODO: remove in 1.15 /** * Check if the face of a block should block rendering. * @@ -112,7 +113,9 @@ public interface IForgeBlockState * @param pos Block position in world * @param face The side to check * @return True if the block is opaque on the specified side. + * @deprecated This is no longer used for rendering logic. */ + @Deprecated default boolean doesSideBlockRendering(IEnviromentBlockReader world, BlockPos pos, Direction face) { return getBlockState().getBlock().doesSideBlockRendering(getBlockState(), world, pos, face);