From 5eadf5533d2cf091a7192ae5216c0d4ae64a055d Mon Sep 17 00:00:00 2001 From: SquidDev Date: Thu, 15 Feb 2018 17:56:08 +0000 Subject: [PATCH] Fix wireless modems suffocating entities As of #458, BlockPeripheral will act as a full/opaque block for some peripherals and a transparent one for others. However, some Block methods use the default state rather than the current one. This means modems report being a full block when they are not, leading to suffocating entities and lighting glitches. --- .../peripheral/common/BlockPeripheral.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/main/java/dan200/computercraft/shared/peripheral/common/BlockPeripheral.java b/src/main/java/dan200/computercraft/shared/peripheral/common/BlockPeripheral.java index 34ff51ee5..9f77cd5cf 100644 --- a/src/main/java/dan200/computercraft/shared/peripheral/common/BlockPeripheral.java +++ b/src/main/java/dan200/computercraft/shared/peripheral/common/BlockPeripheral.java @@ -631,6 +631,13 @@ public class BlockPeripheral extends BlockPeripheralBase return isOpaqueCube( state ); } + @Override + @Deprecated + public boolean isFullBlock( IBlockState state ) + { + return isOpaqueCube( state ); + } + @Nonnull @Override @Deprecated @@ -638,4 +645,20 @@ public class BlockPeripheral extends BlockPeripheralBase { return isOpaqueCube( state ) ? BlockFaceShape.SOLID : BlockFaceShape.UNDEFINED; } + + @Override + @Deprecated + public boolean causesSuffocation(IBlockState state) + { + // This normally uses the default state + return blockMaterial.blocksMovement() && state.isOpaqueCube(); + } + + @Override + @Deprecated + public int getLightOpacity( IBlockState state ) + { + // This normally uses the default state + return isOpaqueCube( state ) ? 255 : 0; + } }