fixed a crash with pneumaticcraft drones

closes #273
This commit is contained in:
Ell 2023-01-28 10:50:13 +01:00
parent 55ad057dda
commit 335c01702b
2 changed files with 3 additions and 3 deletions

View file

@ -114,7 +114,7 @@ public class BlockContainerImpl extends BaseEntityBlock implements IModItem {
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) { public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
var drops = super.getDrops(state, 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) { if (tile instanceof BlockEntityImpl) {
for (var stack : drops) { for (var stack : drops) {
if (stack.getItem() != this.asItem()) if (stack.getItem() != this.asItem())

View file

@ -105,8 +105,8 @@ public class BlockEndFlower extends BushBlock implements IModItem, ICustomBlockS
@Override @Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) { public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
var tile = builder.getParameter(LootContextParams.BLOCK_ENTITY); var tile = builder.getOptionalParameter(LootContextParams.BLOCK_ENTITY);
if (tile instanceof BlockEntityEndFlower && ((BlockEntityEndFlower) tile).isDrainMode) if (tile instanceof BlockEntityEndFlower f && f.isDrainMode)
return NonNullList.create(); return NonNullList.create();
return super.getDrops(state, builder); return super.getDrops(state, builder);
} }