From 74982c36b5eb0301b8e36211b8333e0963e43369 Mon Sep 17 00:00:00 2001 From: Mrbysco Date: Tue, 5 Nov 2024 22:17:19 +0100 Subject: [PATCH] Fix village house machines dropping on breaking (Fixing #1436) --- .../mod/blocks/base/BlockContainerBase.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java index 641067e89..91e3e4177 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java @@ -29,6 +29,7 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.EntityBlock; import net.minecraft.world.level.block.RenderShape; import net.minecraft.world.level.block.entity.BlockEntity; @@ -194,11 +195,10 @@ public abstract class BlockContainerBase extends Block implements EntityBlock { @Override public BlockState playerWillDestroy(@Nonnull Level world, @Nonnull BlockPos pos, @Nonnull BlockState state, Player player) { BlockState theState = super.playerWillDestroy(world, pos, state, player); - if (!player.isCreative()) { - BlockEntity tile = world.getBlockEntity(pos); - if (tile instanceof TileEntityBase && ((TileEntityBase) tile).stopFromDropping) { + if (!player.isCreative() && world.getBlockEntity(pos) instanceof TileEntityBase tileBase && tileBase.stopFromDropping) { + if (!world.isClientSide) player.displayClientMessage(Component.translatable("info.actuallyadditions.machineBroke").withStyle(ChatFormatting.RED), false); - } + return Blocks.AIR.defaultBlockState(); } return theState; }