[Fix] Ensure that a null drop does not cause crashes (quiqueck/BetterNether#148)

This commit is contained in:
Frank 2023-07-08 11:35:32 +02:00
parent 30e95aa644
commit b435519823

View file

@ -102,7 +102,7 @@ public class BaseOreBlock extends DropExperienceBlock implements BlockModelProvi
LootParams.Builder builder
) {
ItemStack tool = builder.getParameter(LootContextParams.TOOL);
if (tool != null && tool.isCorrectToolForDrops(state)) {
if (tool != null && tool.isCorrectToolForDrops(state) && dropItem != null) {
boolean canMine = miningLevel == 0;
if (tool.getItem() instanceof TieredItem tired) {
canMine = tired.getTier().getLevel() >= miningLevel;