diff --git a/src/main/java/dev/galacticraft/mod/api/block/MultiBlockMachineBlock.java b/src/main/java/dev/galacticraft/mod/api/block/MultiBlockMachineBlock.java index 9fc13195b..0249d51a4 100644 --- a/src/main/java/dev/galacticraft/mod/api/block/MultiBlockMachineBlock.java +++ b/src/main/java/dev/galacticraft/mod/api/block/MultiBlockMachineBlock.java @@ -28,6 +28,7 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.Block; @@ -57,6 +58,18 @@ public BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, return returnState; } + @Override + public void wasExploded(Level world, BlockPos pos, Explosion explosion) { + for (BlockPos part : this.getOtherParts(world.getBlockState(pos))) { + part = pos.immutable().offset(part); + if (!(world.getBlockEntity(part) instanceof MultiBlockPart)) { + continue; + } + world.removeBlock(part, false); + } + super.wasExploded(world, pos, explosion); + } + @Override public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { for (BlockPos otherPart : this.getOtherParts(state)) {