
Uncaught NPE in PlayerEntityMixin
Linguardium opened this issue ยท 2 comments
if there is no instance that matches the provided HEALTH_BOOST, then it will be null and the call to getDuration will crash. do a null check
if(playerEntity.getActiveStatusEffects().get(StatusEffects.HEALTH_BOOST) instanceof StatusEffectInstanceAccessor instance && instance.getDuration() == 2*20)
for instance this will nullcheck and cast all at once (instanceof will nullcheck and on modern java you can create a variable of type automatically in the same line)