mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-21 23:13:28 +01:00
Fix village house machines dropping on breaking (Fixing #1436)
This commit is contained in:
parent
74addcb6e0
commit
74982c36b5
1 changed files with 4 additions and 4 deletions
|
@ -29,6 +29,7 @@ import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.LevelReader;
|
import net.minecraft.world.level.LevelReader;
|
||||||
import net.minecraft.world.level.block.Block;
|
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.EntityBlock;
|
||||||
import net.minecraft.world.level.block.RenderShape;
|
import net.minecraft.world.level.block.RenderShape;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
|
@ -194,11 +195,10 @@ public abstract class BlockContainerBase extends Block implements EntityBlock {
|
||||||
@Override
|
@Override
|
||||||
public BlockState playerWillDestroy(@Nonnull Level world, @Nonnull BlockPos pos, @Nonnull BlockState state, Player player) {
|
public BlockState playerWillDestroy(@Nonnull Level world, @Nonnull BlockPos pos, @Nonnull BlockState state, Player player) {
|
||||||
BlockState theState = super.playerWillDestroy(world, pos, state, player);
|
BlockState theState = super.playerWillDestroy(world, pos, state, player);
|
||||||
if (!player.isCreative()) {
|
if (!player.isCreative() && world.getBlockEntity(pos) instanceof TileEntityBase tileBase && tileBase.stopFromDropping) {
|
||||||
BlockEntity tile = world.getBlockEntity(pos);
|
if (!world.isClientSide)
|
||||||
if (tile instanceof TileEntityBase && ((TileEntityBase) tile).stopFromDropping) {
|
|
||||||
player.displayClientMessage(Component.translatable("info.actuallyadditions.machineBroke").withStyle(ChatFormatting.RED), false);
|
player.displayClientMessage(Component.translatable("info.actuallyadditions.machineBroke").withStyle(ChatFormatting.RED), false);
|
||||||
}
|
return Blocks.AIR.defaultBlockState();
|
||||||
}
|
}
|
||||||
return theState;
|
return theState;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue