[≤ v1.2.1] Crash when switching tabs
Abalieno opened this issue · 10 comments
And here's the link to the line of code in their mod that is causing the crash
Like I said, first check if the entity is in a ServerWorld
, and if it is, only then send S2C
packets.
Nope, but maybe this crash is more specific.
Hmm, it appears the crash was caused by the Miskatonic Mysteries mod, therefore by that logic, this mod conflicts with that mod.
Here's the crash cause:
(stack traces are read from bottom to top)
java.lang.IllegalArgumentException: Only supported on server worlds!
at net.fabricmc.fabric.api.networking.v1.PlayerLookup.tracking(PlayerLookup.java:127)
at com.miskatonicmysteries.common.handler.networking.packet.s2c.SmokeEffectPacket.send(SmokeEffectPacket.java:29)
at com.miskatonicmysteries.common.feature.entity.GuardDogEntity.method_5650(GuardDogEntity.java:66)
at net.minecraft.class_1297.method_31472(class_1297.java:363)
at thecsdev.betterstats.client.gui.util.StatUtils$SUMobStat.<init>(StatUtils.java:281)
This mod is attempting to render an entity from that mod onto the screen (client-side obviously), but that mod is then attempting to perform it's mob-related action only servers can do, resulting in the crash... I will try and see if I can do something about this.
Here's my mod attempting to render the entity from that mod:
(stack traces are read from bottom to top)
at net.minecraft.class_1297.method_31472(class_1297.java:363)
at thecsdev.betterstats.client.gui.util.StatUtils$SUMobStat.<init>(StatUtils.java:281)
And once my mod creates a copy of the entity for rendering, that mod attempts to do it's own entity handling things that can unfortunately only be done server-side, and that is sending an S2C (server 2 client) packet.
at net.fabricmc.fabric.api.networking.v1.PlayerLookup.tracking(PlayerLookup.java:127)
at com.miskatonicmysteries.common.handler.networking.packet.s2c.SmokeEffectPacket.send(SmokeEffectPacket.java:29)
at com.miskatonicmysteries.common.feature.entity.GuardDogEntity.method_5650(GuardDogEntity.java:66)
In the meantime, could you please submit a bug report to the developer of that mod asking them to perform side checks first before sending packets? (side checks should always be done before doing something like this) That would help a lot in resolving that/this bug. You can even link them to this bug report for context and clarity.
The bug is about GuardDogEntity
sending S2C
packets while the entity is in a ClientWorld
. The developer of that mod needs to first check if their GuardDogEntity
is in a ServerWorld
before sending that S2C
packet.
Edit: Grammar.. again.
Hello. Thank you for reporting this issue. I think I know what may be happening here. A mod you are using contains a mob that cannot be "created" aka "summoned". The way mobs are rendered on the screen is, the mod has to "create" aka "summon" a copy of the said mob in order to render it, but when a mob is not "summon-able", it results in the crash.
For testing reasons, I wanna make* sure my patch actually fixes the bug, so could you please let me know if you used a mod pack with this mod or not, and what mod pack you used? I would like to test my patch there before publishing it. I know I could take a look at the report, but it lists dozens and dozens of "internal" mods and libraries as well, so keeping track of all that is a nightmare.
Thank you once again, and have a good day. I will now work on fixing this bug.
Edit: Grammar.
Also, I managed to play-test this scenario taking place without the mod pack. Hopefully it is resolved now.
Thank you once again for the report. I have (hopefully) resolved this bug and published the patch. I will keep this issue open just in case you still encounter issues. You may feel free to close this issue if the patch resolved this bug and if there is nothing else you'd like to add.
Edit:
And forgot to add, have a great day!
I have decided to patch the bug on my end as well by try-catch
-ing any IllegalArgumentException
s that may occur from other mods. This will hopefully not only guarantee a fix fo this issue, but will also patch any potential issues with other mods doing a similar thing. Hopefully that Miskatonic Mysteries
mod has that issue in just that one spot. I will analyse it and make sure that is the case.
I have a few other updates to my mod planned, so I will release this patch alongside those other changes once I make them. Thank you for submitting the bug report both here and there, and thank you to the person that patched that bug there.
https://mclo.gs/iWC4Dhp#L12301
client crashed when switching tabs on the stat screen ... is this the same issue here?
It appears like it is:
Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.class_1297.method_31472()" because "this.entity" is null
at thecsdev.betterstats.client.gui.util.StatUtils$SUMobStat.<init>(StatUtils.java:281) ~[betterstats-1.2.1.jar:?]
at thecsdev.betterstats.client.gui.util.StatUtils.getMobStats(StatUtils.java:145) ~[betterstats-1.2.1.jar:?]
at thecsdev.betterstats.client.gui.util.StatUtils.getMobStats(StatUtils.java:120) ~[betterstats-1.2.1.jar:?]
at thecsdev.betterstats.client.gui.screen.BetterStatsScreen.update_drawEntityStats(BetterStatsScreen.java:437) ~[betterstats-1.2.1.jar:?]
I also made a small error on my end where I overlooked the fact that some entities are not "summon-able" aka cannot be created and rendered on the screen, thus causing the crash. I do have a patch ready tho, which I will publish right as I fix the bug where stat tooltips don't show when too many entries are present.
The issue in general is this mod not working properly when combined with some other mods because those* other mods might not expect their entities to be rendered on the screen like my mod does. Sorry about the inconvenience, I will publish a patch that hopefully fixes all that as soon as I can.
Edit: grammar again
Also, I just noticed about 3h ago, my mod got featured in the Medieval MC mod pack, but that mod pack contains one of those mods that crashes the game when used with this mod, so I will have to release that patch asap.