Closed Kasualix closed 10 months ago
The owner should never be null, it is set in the constructor via this mixin https://github.com/Shadows-of-Fire/Apothic-Attributes/blob/b60c186e27dba0493a56c62d7d560ebec86e6b82/src/main/java/dev/shadowsoffire/attributeslib/mixin/LivingEntityMixin.java#L36-L43
And this code is executed well after the constructor, given that it is from an entity join level event.
So the question then becomes why is the owner null. This is an error condition, and adding a null check would just mask the error. You might want to try removing mods to see if you can determine what is messing with the attribute map, since it looks like this will trigger consistently on world load until the change is undone.
It seems only that world is broken A new created world will not crash.
Ice and Fire updates attributes the attribute modifier map before the entity is initialized so people can dynamically change them via config files. Example (entity code interface code ) Is this a very bodged way of doing things? Absolutely! But as far as I know there's no other way of accomplishing this behavior.
This causes the exact behavior as described here. I'm very much willing to fix this issue on my end but I wouldn't know how.
I would need to know the exact goal this is accomplishing. If this is just adjusting the base values of attributes, this is unnecessary, as they can be changed retroactively.
No idea why I never thought about doing that... Oh well thanks :) Might still be a good idea to add a check with an error log on your end, in case other people are as dumb as me but I can also understand if you don't want to do that!
I'll be adding a proper error message but the crash will still happen when an owner can't be detected, and unfortunately the errors will probably not be super helpful since there is no way to detect who the owner should have been.
https://github.com/Shadows-of-Fire/Apothic-Attributes/blob/b60c186e27dba0493a56c62d7d560ebec86e6b82/src/main/java/dev/shadowsoffire/attributeslib/mixin/AttributeMapMixin.java#L46 perhaps requires a null check for the owner
crash report: https://gist.github.com/Kasualix/913f8a2f498c1492a38ddc2b0b902a0e