From 41b1935e6590cfcca175ed0a2e8612b2db585381 Mon Sep 17 00:00:00 2001 From: Ruben Taelman Date: Tue, 19 Nov 2024 10:17:37 +0100 Subject: [PATCH] Fix Fabric crash on explosion, Closes #174 --- gradle.properties | 2 +- .../org/cyclops/colossalchests/block/ChestWallFabric.java | 6 +++++- .../cyclops/colossalchests/block/ColossalChestFabric.java | 6 +++++- .../org/cyclops/colossalchests/block/InterfaceFabric.java | 6 +++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index c22176ba..76adb599 100644 --- a/gradle.properties +++ b/gradle.properties @@ -44,4 +44,4 @@ org.gradle.daemon=false org.gradle.caching=true # Common dependencies -cyclopscore_version=1.25.1-627 +cyclopscore_version=1.25.3-636 diff --git a/loader-fabric/src/main/java/org/cyclops/colossalchests/block/ChestWallFabric.java b/loader-fabric/src/main/java/org/cyclops/colossalchests/block/ChestWallFabric.java index fa509a7a..9d9b9458 100644 --- a/loader-fabric/src/main/java/org/cyclops/colossalchests/block/ChestWallFabric.java +++ b/loader-fabric/src/main/java/org/cyclops/colossalchests/block/ChestWallFabric.java @@ -9,7 +9,11 @@ public class ChestWallFabric extends ChestWall { public ChestWallFabric(Properties properties, ChestMaterial material) { super(properties, material); - IBlockExplodedEvent.EVENT.register((blockState, level, blockPos, explosion, biConsumer) -> onBlockExplodedCommon(blockState, level, blockPos, explosion)); + IBlockExplodedEvent.EVENT.register((blockState, level, blockPos, explosion, biConsumer) -> { + if (blockState.getBlock() == this) { + onBlockExplodedCommon(blockState, level, blockPos, explosion); + } + }); } @Override diff --git a/loader-fabric/src/main/java/org/cyclops/colossalchests/block/ColossalChestFabric.java b/loader-fabric/src/main/java/org/cyclops/colossalchests/block/ColossalChestFabric.java index ea869884..63358aab 100644 --- a/loader-fabric/src/main/java/org/cyclops/colossalchests/block/ColossalChestFabric.java +++ b/loader-fabric/src/main/java/org/cyclops/colossalchests/block/ColossalChestFabric.java @@ -10,7 +10,11 @@ public class ColossalChestFabric extends ColossalChest { public ColossalChestFabric(Properties properties, ChestMaterial material) { super(properties, material, BlockEntityColossalChest::new); - IBlockExplodedEvent.EVENT.register((blockState, level, blockPos, explosion, biConsumer) -> onBlockExplodedCommon(blockState, level, blockPos, explosion)); + IBlockExplodedEvent.EVENT.register((blockState, level, blockPos, explosion, biConsumer) -> { + if (blockState.getBlock() == this) { + onBlockExplodedCommon(blockState, level, blockPos, explosion); + } + }); } @Override diff --git a/loader-fabric/src/main/java/org/cyclops/colossalchests/block/InterfaceFabric.java b/loader-fabric/src/main/java/org/cyclops/colossalchests/block/InterfaceFabric.java index 4b9573ee..8f144983 100644 --- a/loader-fabric/src/main/java/org/cyclops/colossalchests/block/InterfaceFabric.java +++ b/loader-fabric/src/main/java/org/cyclops/colossalchests/block/InterfaceFabric.java @@ -10,7 +10,11 @@ public class InterfaceFabric extends Interface { public InterfaceFabric(Properties properties, ChestMaterial material) { super(properties, material, BlockEntityInterface::new); - IBlockExplodedEvent.EVENT.register((blockState, level, blockPos, explosion, biConsumer) -> onBlockExplodedCommon(blockState, level, blockPos, explosion)); + IBlockExplodedEvent.EVENT.register((blockState, level, blockPos, explosion, biConsumer) -> { + if (blockState.getBlock() == this) { + onBlockExplodedCommon(blockState, level, blockPos, explosion); + } + }); } @Override