Skip to content

Commit

Permalink
Prevent removed mods' food from becoming air on read and causing fail…
Browse files Browse the repository at this point in the history
…ures further on
  • Loading branch information
Thodor12 committed Jan 7, 2025
1 parent ebe99bb commit c46a9c3
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.minecolonies.api.colony.requestsystem.token.IToken;
import com.minecolonies.api.crafting.ItemStorage;
import com.minecolonies.api.crafting.RecipeStorage;
import com.minecolonies.api.items.IMinecoloniesFoodItem;
import com.minecolonies.api.util.InventoryUtils;
import com.minecolonies.api.util.ItemStackUtils;
import com.minecolonies.api.util.MathUtils;
Expand All @@ -29,6 +30,7 @@
import java.util.function.Predicate;

import static com.minecolonies.api.research.util.ResearchConstants.MIN_ORDER;
import static com.minecolonies.api.util.ItemStackUtils.ISFOOD;

/**
* Minimum stock module.
Expand Down Expand Up @@ -205,7 +207,11 @@ public void deserializeNBT(final CompoundTag compound)
final ListTag minimumStockTagList = compound.getList(TAG_MENU, Tag.TAG_COMPOUND);
for (int i = 0; i < minimumStockTagList.size(); i++)
{
menu.add(new ItemStorage(ItemStack.of(minimumStockTagList.getCompound(i))));
final ItemStack itemStack = ItemStack.of(minimumStockTagList.getCompound(i));
if (ISFOOD.test(itemStack) || itemStack.getItem() instanceof IMinecoloniesFoodItem)
{
menu.add(new ItemStorage(itemStack));
}
}
}

Expand Down

0 comments on commit c46a9c3

Please sign in to comment.