Untamed Wilds

Untamed Wilds

8M Downloads

Crash when Hovering over certain items [tooltip issue]

Davoleo opened this issue ยท 3 comments

commented

When hovering over a certain item from this mod in REI the game crashes,
this also breaks REI's tooltip search with the same exceptions, but they don't terminate the game since they're not on the main thread

Minecraft Version: 1.18.2
Untamed Wilds Version: 2.4.0
REI Version: 8.3.594

Logs: https://paste.atlauncher.com/view/a605091d-3201-49ee-926d-2f2fa895da1c
Stacktrace Excerpt:

Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 8 out of bounds for length 8
[20/05/2023 23:39:02 PM] 	at MC-BOOTSTRAP/[email protected]/com.google.common.collect.RegularImmutableList.get(RegularImmutableList.java:77)
[20/05/2023 23:39:02 PM] 	at TRANSFORMER/[email protected]/untamedwilds.util.EntityDataHolder.getName(EntityDataHolder.java:82)
[20/05/2023 23:39:02 PM] 	at TRANSFORMER/[email protected]/untamedwilds.util.EntityUtils.getVariantName(EntityUtils.java:353)
[20/05/2023 23:39:02 PM] 	at TRANSFORMER/[email protected]/untamedwilds.item.MobBottledItem.m_7626_(MobBottledItem.java:46)
[20/05/2023 23:39:02 PM] 	at TRANSFORMER/[email protected]/net.minecraft.world.item.ItemStack.m_41786_(ItemStack.java:593)
[20/05/2023 23:39:02 PM] 	at TRANSFORMER/[email protected]/net.minecraft.world.item.ItemStack.m_41651_(ItemStack.java:629)
[20/05/2023 23:39:02 PM] 	at TRANSFORMER/[email protected]/me.shedaniel.rei.plugin.client.entry.ItemEntryDefinition.tryGetItemStackToolTip(ItemEntryDefinition.java:226)
[20/05/2023 23:39:02 PM] 	at TRANSFORMER/[email protected]/me.shedaniel.rei.plugin.client.entry.ItemEntryDefinition$ItemEntryRenderer.getTooltip(ItemEntryDefinition.java:371)
[20/05/2023 23:39:02 PM] 	at TRANSFORMER/[email protected]/me.shedaniel.rei.impl.common.entry.AbstractEntryStack.getTooltip(AbstractEntryStack.java:211)
[20/05/2023 23:39:02 PM] 	... 8 more

Extra Notes: I'm not able to reproduce it in a new world with only Untamed Wilds and REI or Untamed Wilds alone, so I'm thinking it has something to do with existing worlds and some saved information that in some way is invalid and results in the out of bounds access, although I don't know much else, furthermore I think the crash happened while hovering over some of the eggs, so it might be related to the tooltips that in a new world are all set to '???'

commented

I save the variants as numbers (0 to n), but positions start from 1

Which part of code caused it start from 1?

commented
commented

I can pretty much guarantee it is an UntamedWilds issue
I save the variants as numbers (0 to n), but positions start from 1, something got lost in the translation for REI and it crashes

Doesn't seem anything too bad