New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No null check for Minecraft.getInstance().player, causing crash #60
Comments
Will add a null-check in the next release. |
I've recieved another crash report from a player having issues with a missing null check. crash-2022-09-22_10.49.46-client.txt After scanning through your code, I think the problem is on this line, but I'm not completely sure. You're probably more familiar with your own code. 3d-Skin-Layers/Shared/src/main/java/dev/tr7zw/skinlayers/mixin/CustomHeadLayerMixin.java Line 41 in 6721a51
Could you add another null check here? I can also try to find all problematic spots myself and open a PR if needed, but I might miss some. |
Looks like |
I'm not sure if other mods modify |
Ok now I'm home and can actually look at the stack trace with mappings. The issue is that it's rendering a player head(the item) while not in a world.
This is in general an issue since there is no vanilla equivalent. So there is no right way to do it, and any way will cause other problems. You must have some dummy world to render that fake entity, so it could be argued that during the rendering, the That's the reason I decided to not bother, and just don't show player previews while not ingame(3d skin layers/wave capes). Guess I'll add another null check for the next version, but it's more a bandaid than anything. |
I've had surprisingly few reports about incompatibilities with mods that don't nullcheck I'll probably add a "compatibility mode" or something to my mod in the future, making it disable the previews when no world is loaded. By default they'll still be enabled though, since they're quite important to my UI design. Its fully understandable if you don't want to bother supporting this, but I'd appreciate it if you do. :) |
I've noticed that in
PlayerRendererMixin::setModelProperties
you useMinecraft.getInstance().player
without a null check.Normally this wouldn't be a problem, since no players will get rendered unless the user has a world loaded. However, this causes issues when a mod tries to render a PlayerEntity while no world is loaded, which one of my mods does. See crash report here.
This could likely be fixed very easily by adding a null check that either: cancels the method, or preferably, skips the distance check that causes the issue.
The text was updated successfully, but these errors were encountered: