Skip to content

Commit 5ddbbab

Browse files
committed
fix: Handle missing BLOCK_ENTITY loot param in Broken Spawner loot modifier
Fixes: GH-1047
1 parent 9c19664 commit 5ddbbab

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/com/enderio/base/common/loot/BrokenSpawnerLootModifier.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ public BrokenSpawnerLootModifier(LootItemCondition[] conditionsIn) {
3636

3737
@Override
3838
protected ObjectArrayList<ItemStack> doApply(ObjectArrayList<ItemStack> generatedLoot, LootContext context) {
39-
BlockEntity entity = context.getParam(LootContextParams.BLOCK_ENTITY);
39+
BlockEntity entity = context.getParamOrNull(LootContextParams.BLOCK_ENTITY);
40+
if (entity == null) {
41+
return generatedLoot;
42+
}
43+
4044
if (entity instanceof SpawnerBlockEntity spawnerBlockEntity) {
4145
if (!context.getParam(LootContextParams.TOOL).is(EIOTags.Items.BROKEN_SPAWNER_BLACKLIST)) {
4246
if (context.getRandom().nextFloat() < BaseConfig.COMMON.BLOCKS.BROKEN_SPAWNER_DROP_CHANCE.get()) {

0 commit comments

Comments
 (0)