Fixed forge rendering pipeline and shape based light occulsion. (#6178)

This commit is contained in:
Wyn Price 2019-10-22 23:29:27 +01:00 committed by LexManos
parent ebf489be8c
commit 6422310453
3 changed files with 15 additions and 1 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);