Fixes a dupe with the crafting halos

adds a check that will be redundant for 99% of items (#29)
This commit is contained in:
梅天佑 authored and GitHub committed 2023-05-17 22:17:37 +02:00
1 parent 33a26a5059
commit 1039b52854
1 file changed
+11 -9
@@ -198,15 +198,17 @@ public class ItemCraftingHalo extends ItemMod implements ICraftAchievement {
ItemStack stackAt = inv.getStackInSlot(i);
if(stackAt != null && stack.isItemEqual(stackAt) && ItemStack.areItemStackTagsEqual(stack, stackAt)) {
boolean consume = true;
ItemStack container = stackAt.getItem().getContainerItem(stackAt);
if(container != null) {
if(container == stackAt)
consume = false;
else {
InventoryHelper.insertItemIntoInventory(inv, container);
if(container.stackSize != 0 && player != null)
player.dropPlayerItemWithRandomChoice(container, false);
if(stackAt.getItem().hasContainerItem()) {
//there are monsters in this world that will return false above but not null below
ItemStack container = stackAt.getItem().getContainerItem(stackAt);
if (container != null) {
if (container == stackAt)
consume = false;
else {
InventoryHelper.insertItemIntoInventory(inv, container);
if (container.stackSize != 0 && player != null)
player.dropPlayerItemWithRandomChoice(container, false);
}
}
}