From 14c280c07ad390a8a34a17166fefa4a787a7921b Mon Sep 17 00:00:00 2001 From: maggi373 <40539743+maggi373@users.noreply.github.com> Date: Thu, 19 Oct 2023 17:26:31 +0200 Subject: [PATCH] fix and testcode for #108 --- .../mekanism/common/block/BlockBounding.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main/java/mekanism/common/block/BlockBounding.java b/src/main/java/mekanism/common/block/BlockBounding.java index 9e5f7b4b0b8..f503fff46c4 100644 --- a/src/main/java/mekanism/common/block/BlockBounding.java +++ b/src/main/java/mekanism/common/block/BlockBounding.java @@ -162,14 +162,19 @@ protected boolean canSilkHarvest() { @Override @Deprecated public void neighborChanged(IBlockState state, World world, BlockPos pos, Block neighborBlock, BlockPos neighborPos) { - TileEntityBoundingBlock tileEntity = (TileEntityBoundingBlock) world.getTileEntity(pos); - if (tileEntity != null) { - tileEntity.onNeighborChange(state.getBlock()); + if (world.getTileEntity(pos) instanceof TileEntityBoundingBlock) { + TileEntityBoundingBlock tileEntity = (TileEntityBoundingBlock) world.getTileEntity(pos); + if (tileEntity != null) { + tileEntity.onNeighborChange(state.getBlock()); + } + BlockPos mainPos = getMainBlockPos(world, pos); + if (mainPos != null) { + IBlockState state1 = world.getBlockState(mainPos); + state1.getBlock().neighborChanged(state1, world, mainPos, neighborBlock, neighborPos); + } } - BlockPos mainPos = getMainBlockPos(world, pos); - if (mainPos != null) { - IBlockState state1 = world.getBlockState(mainPos); - state1.getBlock().neighborChanged(state1, world, mainPos, neighborBlock, neighborPos); + else { + System.out.print("\nCant cast exception\n"); } }