Unchecked casts to ServerLevelAccessor
Closed this issue ยท 3 comments
The event you are using only guarantees a Level object.
you check if the Level object is a clientside level object, but not whether it implements ServerLevelAccessor nor if it is an instance of ServerLevel. This can lead to the event being triggered with a non-client, non ServerLevelAccessor Level object (such as a fake level object or a wrapper level object that does not, itself, implement ServerLevelAccessor).
There are at least 2 instances in this file, but may be more in others. I would suggest turning on some linting on these.
Do you have an actual issue that is caused by this or is this just speculation? I don't think firing the EntityJoinLevelEvent for a non-concrete vanilla level type is well-defined behavior.
Unfortunately, i cant find the context i found this bug under. I want to say this was being fired from with a mod's level wrapping class causing a crash. It was from a crash report i was reviewing somewhere, but may not have been the underlying cause of their issue, just what did the final crash. I will keep looking though