Fixed crash when autocompleting Ender IO recipes from JEI, fixes #1735

This commit is contained in:
raoulvdberge
2018-04-04 19:29:39 +02:00
parent cf6c66d42b
commit f04bbb4669
2 changed files with 11 additions and 9 deletions

View File

@@ -6,6 +6,8 @@
- Fixed Disk Manipulator not extracting items (ineternet) - Fixed Disk Manipulator not extracting items (ineternet)
- Fixed filter slots not caring about max stack size (raoulvdberge) - Fixed filter slots not caring about max stack size (raoulvdberge)
- Fixed model warning about Portable Grid (raoulvdberge) - Fixed model warning about Portable Grid (raoulvdberge)
- Fixed crash when autocompleting Ender IO recipes from JEI (raoulvdberge)
- Fixed Grid not always using all combinations when using JEI autocompletion (raoulvdberge)
- Increased Grid performance (raoulvdberge) - Increased Grid performance (raoulvdberge)
- Various internal refactors (raoulvdberge) - Various internal refactors (raoulvdberge)

View File

@@ -60,18 +60,18 @@ public class RecipeTransferHandlerGrid implements IRecipeTransferHandler {
IGuiIngredient<ItemStack> ingredient = inputs.get(slot.getSlotIndex() + 1); IGuiIngredient<ItemStack> ingredient = inputs.get(slot.getSlotIndex() + 1);
if (ingredient != null) { if (ingredient != null) {
List<ItemStack> possibleItems = ingredient.getAllIngredients();
NBTTagList tags = new NBTTagList(); NBTTagList tags = new NBTTagList();
for (int i = 0; i < possibleItems.size(); ++i) { for (ItemStack possibleItem : ingredient.getAllIngredients()) {
if (i >= 5) { if (possibleItem != null) {
break; // Max 5 possible items to avoid reaching max network packet size possibleItem = possibleItem.copy();
} possibleItem.setTagCompound(possibleItem.getItem().getNBTShareTag(possibleItem));
NBTTagCompound tag = new NBTTagCompound(); NBTTagCompound tag = new NBTTagCompound();
possibleItems.get(i).writeToNBT(tag); possibleItem.writeToNBT(tag);
tags.appendTag(tag);
tags.appendTag(tag);
}
} }
recipe.setTag("#" + slot.getSlotIndex(), tags); recipe.setTag("#" + slot.getSlotIndex(), tags);