From 335c01702bf9bd5cbdc47a7faa97ee698b3b3ece Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sat, 28 Jan 2023 10:50:13 +0100 Subject: [PATCH] fixed a crash with pneumaticcraft drones closes #273 --- .../de/ellpeck/naturesaura/blocks/BlockContainerImpl.java | 2 +- .../java/de/ellpeck/naturesaura/blocks/BlockEndFlower.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockContainerImpl.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockContainerImpl.java index 6b4b64be..56249932 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockContainerImpl.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockContainerImpl.java @@ -114,7 +114,7 @@ public class BlockContainerImpl extends BaseEntityBlock implements IModItem { public List getDrops(BlockState state, LootContext.Builder builder) { var drops = super.getDrops(state, builder); - var tile = builder.getParameter(LootContextParams.BLOCK_ENTITY); + var tile = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY); if (tile instanceof BlockEntityImpl) { for (var stack : drops) { if (stack.getItem() != this.asItem()) diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockEndFlower.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockEndFlower.java index 70a714a2..9f6d361e 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockEndFlower.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockEndFlower.java @@ -105,8 +105,8 @@ public class BlockEndFlower extends BushBlock implements IModItem, ICustomBlockS @Override public List getDrops(BlockState state, LootContext.Builder builder) { - var tile = builder.getParameter(LootContextParams.BLOCK_ENTITY); - if (tile instanceof BlockEntityEndFlower && ((BlockEntityEndFlower) tile).isDrainMode) + var tile = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY); + if (tile instanceof BlockEntityEndFlower f && f.isDrainMode) return NonNullList.create(); return super.getDrops(state, builder); }