Globox1997 / LevelZ

https://modrinth.com/mod/levelz
https://www.curseforge.com/minecraft/mc-mods/levelz
GNU General Public License v3.0
51 stars 50 forks source link

Hardcore questing mod & your mod together crash #128

Closed TheeMrCheeky closed 2 years ago

TheeMrCheeky commented 2 years ago

When creating a new task in quest book it leads to game crashing only when your mod is paired with it

kirderf1 commented 2 years ago

Related issues: https://github.com/lorddusk/HQM/issues/657, https://github.com/AHilyard/LegendaryTooltips/issues/24. Crash appear to happen at https://github.com/Globox1997/LevelZ/blob/fb01405bcfcf21721ea95dbe93140ac72257df71/src/main/java/net/levelz/mixin/item/ItemStackClientMixin.java#L68 where tooltipAddition is null, causing a crash.

Globox1997 commented 2 years ago

Thanks for reporting this, I wonder how the list can be null, maybe Lists.newArrayList(); can be null out of prod env. Fixed with null check https://github.com/Globox1997/LevelZ/commit/7062eff0518db0f4b990c81a438272e76dca3689

kirderf1 commented 2 years ago

Checked back on this after getting a new reported crash, but with levelZ 1.3.3. First, the null check fix is faulty because it uses & instead of &&, causing this.tooltipAddition.isEmpty() to be evaluated regardless of if tooltipAddition is null. Second, I have a good guess on the root of the problem: The air item should have id 0. If the tooltip mixin function were to be called for an item stack for the first time with the air item, this.itemId != itemId would be false (because this.itemId would initialize as 0), causing tooltipAddition to never be initialized. If this really is the case,