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

40 lines
2.4 KiB
Diff

--- ../src-base/minecraft/net/minecraft/block/BlockPane.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPane.java
@@ -112,7 +112,10 @@
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
{
- return state.withProperty(NORTH, Boolean.valueOf(this.attachesTo(worldIn, worldIn.getBlockState(pos.north()), pos.north(), EnumFacing.SOUTH))).withProperty(SOUTH, Boolean.valueOf(this.attachesTo(worldIn, worldIn.getBlockState(pos.south()), pos.south(), EnumFacing.NORTH))).withProperty(WEST, Boolean.valueOf(this.attachesTo(worldIn, worldIn.getBlockState(pos.west()), pos.west(), EnumFacing.EAST))).withProperty(EAST, Boolean.valueOf(this.attachesTo(worldIn, worldIn.getBlockState(pos.east()), pos.east(), EnumFacing.WEST)));
+ return state.withProperty(NORTH, canPaneConnectTo(worldIn, pos, EnumFacing.NORTH))
+ .withProperty(SOUTH, canPaneConnectTo(worldIn, pos, EnumFacing.SOUTH))
+ .withProperty(WEST, canPaneConnectTo(worldIn, pos, EnumFacing.WEST))
+ .withProperty(EAST, canPaneConnectTo(worldIn, pos, EnumFacing.EAST));
}
public Item getItemDropped(IBlockState state, Random rand, int fortune)
@@ -197,6 +200,24 @@
return new BlockStateContainer(this, new IProperty[] {NORTH, EAST, WEST, SOUTH});
}
+ /* ======================================== FORGE START ======================================== */
+
+ @Override
+ public boolean canBeConnectedTo(IBlockAccess world, BlockPos pos, EnumFacing facing)
+ {
+ BlockPos offset = pos.offset(facing);
+ return attachesTo(world, world.getBlockState(offset), offset, facing.getOpposite());
+ }
+
+ public boolean canPaneConnectTo(IBlockAccess world, BlockPos pos, EnumFacing dir)
+ {
+ BlockPos other = pos.offset(dir);
+ IBlockState state = world.getBlockState(other);
+ return state.getBlock().canBeConnectedTo(world, other, dir.getOpposite()) || attachesTo(world, state, other, dir.getOpposite());
+ }
+
+ /* ======================================== FORGE END ======================================== */
+
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face)
{
return face != EnumFacing.UP && face != EnumFacing.DOWN ? BlockFaceShape.MIDDLE_POLE_THIN : BlockFaceShape.CENTER_SMALL;