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

[1.18.1] Crash with SurvivalPlus Lightsabers when hovering lightsaber in inventory to view tooltip. #81

Closed lizfinite closed 2 years ago

lizfinite commented 2 years ago

Not sure if this is something to be fixed on your end, or theirs but I'll open one here just in case.

Crash Log: https://paste.ee/p/Klhil

Mods:

Steps to reproduce:

  1. Enter world
  2. Give any lightsaber
  3. Hover within inventory
coolsimulations commented 2 years ago

This is definitely an issue with LevelZ. The problem is that Lightsabers are included in the Sword Fabric Tool Tag but since the Lightsaber isn't an instance of ToolItem, it cannot be cast and thus crashes. The crash would occur with any other kind of tool/sword mod that doesn't extend the ToolItem class.

My crash report crash-2022-01-22_08.43.11-client.txt

Where it crashes: https://github.com/Globox1997/LevelZ/blob/d662fe456a015e1be78928ad8a37925b3ca25c29/src/main/java/net/levelz/mixin/item/ItemStackClientMixin.java#L184-L190

A simple fix would be to check if the item is an instance of ToolItem rather than to straight up cast.

Globox1997 commented 2 years ago

Fixed with https://github.com/Globox1997/LevelZ/commit/ccf93b863654980dd6176695bc315957171d728d