Closed Vaelzan closed 2 years ago
Hey Vaelzan, thanks for reporting this bug, a crash log would be better than a screenshot but you already explained what the issue is, which makes it easy for me to fix it, so thx :) I wonder how the user variable is null in some cases but yes an instanceof check will fix this. Fixed with https://github.com/Globox1997/LevelZ/commit/9e7ca1cddffbf9a963a94191db0dd5b9fe7d2aa2
There's a couple of areas that can crash in EnchantmentHelperMixin. We're getting a heap of reports on the Valhelsia Discord that in Valhelsia: Enhanced Vanilla we're having a crash occur when Shulker Bullets collide with a player on servers, and narrowed it down to a
onTargetDamagedMixin
in LevelZ. Glancing at the rest of the code, it looks like a similar crash is possible inonUserDamagedMixin
, although it's the former that is triggering the crashes that are reported to us, such as in the image below (sorry it's not on Gist, but people report bugs in weird ways on Discord).https://cdn.discordapp.com/attachments/856905835069964319/955018589944049694/unknown.png
This: https://github.com/Globox1997/LevelZ/blob/6144f4e9e7bc07328eb315554b4cce0eb5c1f198/src/main/java/net/levelz/mixin/misc/EnchantmentHelperMixin.java#L43 and this https://github.com/Globox1997/LevelZ/blob/6144f4e9e7bc07328eb315554b4cce0eb5c1f198/src/main/java/net/levelz/mixin/misc/EnchantmentHelperMixin.java#L68 are causing crashes due to the
user
variable being used to createitem
before the check to see if it's aPlayerEntity
(which is checked on the following line). It's an easy fix, just checkuser instanceof PlayerEntity
on the lines before the lines that are creating theitem
variable, instead of as part of theitem instanceof ToolItem
check that is on the line after.