Files
2019-02-24 22:29:41 +08:00

100 lines
4.5 KiB
Diff

--- ../src-base/minecraft/net/minecraft/block/BlockSlab.java
+++ ../src-work/minecraft/net/minecraft/block/BlockSlab.java
@@ -21,7 +21,7 @@
public abstract class BlockSlab extends Block
{
- public static final PropertyEnum<BlockSlab.EnumBlockHalf> HALF = PropertyEnum.<BlockSlab.EnumBlockHalf>create("half", BlockSlab.EnumBlockHalf.class);
+ public static final PropertyEnum<EnumBlockHalf> HALF = PropertyEnum.<EnumBlockHalf>create("half", EnumBlockHalf.class);
protected static final AxisAlignedBB AABB_BOTTOM_HALF = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.5D, 1.0D);
protected static final AxisAlignedBB AABB_TOP_HALF = new AxisAlignedBB(0.0D, 0.5D, 0.0D, 1.0D, 1.0D, 1.0D);
@@ -50,13 +50,13 @@
}
else
{
- return state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP ? AABB_TOP_HALF : AABB_BOTTOM_HALF;
+ return state.getValue(HALF) == EnumBlockHalf.TOP ? AABB_TOP_HALF : AABB_BOTTOM_HALF;
}
}
public boolean isTopSolid(IBlockState state)
{
- return ((BlockSlab)state.getBlock()).isDouble() || state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP;
+ return ((BlockSlab)state.getBlock()).isDouble() || state.getValue(HALF) == EnumBlockHalf.TOP;
}
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face)
@@ -65,13 +65,13 @@
{
return BlockFaceShape.SOLID;
}
- else if (face == EnumFacing.UP && state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP)
+ else if (face == EnumFacing.UP && state.getValue(HALF) == EnumBlockHalf.TOP)
{
return BlockFaceShape.SOLID;
}
else
{
- return face == EnumFacing.DOWN && state.getValue(HALF) == BlockSlab.EnumBlockHalf.BOTTOM ? BlockFaceShape.SOLID : BlockFaceShape.UNDEFINED;
+ return face == EnumFacing.DOWN && state.getValue(HALF) == EnumBlockHalf.BOTTOM ? BlockFaceShape.SOLID : BlockFaceShape.UNDEFINED;
}
}
@@ -80,9 +80,22 @@
return this.isDouble();
}
+ @Override
+ public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face)
+ {
+ if (net.minecraftforge.common.ForgeModContainer.disableStairSlabCulling)
+ return super.doesSideBlockRendering(state, world, pos, face);
+
+ if ( state.isOpaqueCube() )
+ return true;
+
+ EnumBlockHalf side = state.getValue(HALF);
+ return (side == EnumBlockHalf.TOP && face == EnumFacing.UP) || (side == EnumBlockHalf.BOTTOM && face == EnumFacing.DOWN);
+ }
+
public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
{
- IBlockState iblockstate = super.getStateForPlacement(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM);
+ IBlockState iblockstate = super.getStateForPlacement(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(HALF, EnumBlockHalf.BOTTOM);
if (this.isDouble())
{
@@ -90,7 +103,7 @@
}
else
{
- return facing != EnumFacing.DOWN && (facing == EnumFacing.UP || (double)hitY <= 0.5D) ? iblockstate : iblockstate.withProperty(HALF, BlockSlab.EnumBlockHalf.TOP);
+ return facing != EnumFacing.DOWN && (facing == EnumFacing.UP || (double)hitY <= 0.5D) ? iblockstate : iblockstate.withProperty(HALF, EnumBlockHalf.TOP);
}
}
@@ -115,11 +128,11 @@
{
return false;
}
- else
+ else if (false) // Forge: Additional logic breaks doesSideBlockRendering and is no longer useful.
{
IBlockState iblockstate = blockAccess.getBlockState(pos.offset(side));
- boolean flag = isHalfSlab(iblockstate) && iblockstate.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP;
- boolean flag1 = isHalfSlab(blockState) && blockState.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP;
+ boolean flag = isHalfSlab(iblockstate) && iblockstate.getValue(HALF) == EnumBlockHalf.TOP;
+ boolean flag1 = isHalfSlab(blockState) && blockState.getValue(HALF) == EnumBlockHalf.TOP;
if (flag1)
{
@@ -149,6 +162,7 @@
return !isHalfSlab(iblockstate) || flag;
}
}
+ return super.shouldSideBeRendered(blockState, blockAccess, pos, side);
}
@SideOnly(Side.CLIENT)