1.11.2 Crash when picking up items for quest
DingoX3 opened this issue ยท 8 comments
I made the first quest 4 wood logs and turned on fuzzy for any type. then when testing it the game crashes as it tries to go into my inventory. I then removed the quests folder to check and was able to pick up wood without crashing.
full crash report: HERE
minecraft: 1.11.2
forge: 13.20.0.2230
hqm: 1.11.2-5.1.0alpha2
Is only hqm installed? I tried serval times to reproduce it the last days and I can't. I'll try with your explanation
canitzp, this code is wrong:
items = NonNullList.create();
NonNullList<ItemStack> mainInventory = player.inventory.mainInventory;
for (int i = 0; i < mainInventory.size(); i++) {
items.set(i, mainInventory.get(i));
}
Basically you make an empty list with NonNullList.create() and then you directly 'set' items in it. 'set' does not automatically grow the list. You need to use items.add(mainInventory.get(i)) instead
@McJty can you look over the fix and say if it should work
It seems ok at first glance but not very efficient as the code makes a copy of a list of items just to count something? If it isn't used much then that's fine