mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 23:27:59 +01:00
Fix (potential crash) with empty recipe remainders
This commit is contained in:
parent
e3bb03f53b
commit
acab28f1ad
1 changed files with 3 additions and 1 deletions
|
@ -1,5 +1,7 @@
|
||||||
package com.minelittlepony.unicopia.item;
|
package com.minelittlepony.unicopia.item;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.item.toxin.ToxicHolder;
|
import com.minelittlepony.unicopia.item.toxin.ToxicHolder;
|
||||||
|
|
||||||
import net.minecraft.advancement.criterion.Criteria;
|
import net.minecraft.advancement.criterion.Criteria;
|
||||||
|
@ -31,7 +33,7 @@ public class DrinkableItem extends Item {
|
||||||
stack.decrement(1);
|
stack.decrement(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return stack.isEmpty() ? new ItemStack(getRecipeRemainder()) : stack;
|
return stack.isEmpty() ? Optional.ofNullable(getRecipeRemainder()).map(Item::getDefaultStack).orElse(ItemStack.EMPTY) : stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue