iPortalTeam / ImmersivePortalsMod

Non-Euclidean in Minecraft. See through portals and teleport seamlessly.
https://qouteall.fun/immptl/
Apache License 2.0
421 stars 100 forks source link

Incompatible with Bobby. Invalid player data at login when mod is loaded #1528

Open Retidurc opened 4 months ago

Retidurc commented 4 months ago

Is it a mod compatibility issue?

No

If it's a mod compatibility issue, please provide the link(s) to the incompatible mod(s)

No response

Minecraft version

1.20.4

Describe the issue

When the mod is enabled, each try to login fails with the following :

[22:07:19] [Server thread/INFO]: Retidurc joined the game [22:07:19] [Server thread/ERROR]: Couldn't place player in world java.lang.IllegalArgumentException: The validated expression is false at org.apache.commons.lang3.Validate.isTrue(Validate.java:180) ~[commons-lang3-3.13.0.jar:?] at qouteall.imm_ptl.core.chunk_loading.ImmPtlChunkTickets.markForLoading(ImmPtlChunkTickets.java:110) ~[immersive-portals-5.1.6-mc1.20.4-fabric.jar:?] at qouteall.imm_ptl.core.chunk_loading.ImmPtlChunkTracking.lambda$updateForPlayer$4(ImmPtlChunkTracking.java:196) ~[immersive-portals-5.1.6-mc1.20.4-fabric.jar:?] at qouteall.imm_ptl.core.chunk_loading.ChunkLoader.foreachChunkPos(ChunkLoader.java:51) ~[immersive-portals-5.1.6-mc1.20.4-fabric.jar:?] at qouteall.imm_ptl.core.chunk_loading.ImmPtlChunkTracking.updateForPlayer(ImmPtlChunkTracking.java:191) ~[immersive-portals-5.1.6-mc1.20.4-fabric.jar:?] at qouteall.imm_ptl.core.chunk_loading.ImmPtlChunkTracking.immediatelyUpdateForPlayer(ImmPtlChunkTracking.java:149) ~[immersive-portals-5.1.6-mc1.20.4-fabric.jar:?] at net.minecraft.class_3324.handler$zkm000$immersive_portals$onOnPlayerConnect(class_3324.java:1033) ~[server-intermediary.jar:?] at net.minecraft.class_3324.method_14570(class_3324.java:282) ~[server-intermediary.jar:?] at net.minecraft.class_8610.method_52408(class_8610.java:128) ~[server-intermediary.jar:?] at net.minecraft.class_8736.method_53043(class_8736.java:20) ~[server-intermediary.jar:?] at net.minecraft.class_8736.method_11054(class_8736.java:7) ~[server-intermediary.jar:?] at net.minecraft.class_2600.method_11072(class_2600.java:24) ~[server-intermediary.jar:?] at net.minecraft.class_3738.run(class_3738.java:18) ~[server-intermediary.jar:?] at net.minecraft.class_1255.method_18859(class_1255.java:156) ~[server-intermediary.jar:?] at net.minecraft.class_4093.method_18859(class_4093.java:23) ~[server-intermediary.jar:?] at net.minecraft.server.MinecraftServer.method_24306(MinecraftServer.java:797) ~[server-intermediary.jar:?] at net.minecraft.server.MinecraftServer.method_18859(MinecraftServer.java:165) ~[server-intermediary.jar:?] at net.minecraft.class_1255.method_16075(class_1255.java:130) ~[server-intermediary.jar:?] at net.minecraft.server.MinecraftServer.method_20415(MinecraftServer.java:779) ~[server-intermediary.jar:?] at net.minecraft.server.MinecraftServer.method_16075(MinecraftServer.java:773) ~[server-intermediary.jar:?] at net.minecraft.class_1255.method_18857(class_1255.java:139) ~[server-intermediary.jar:?] at net.minecraft.server.MinecraftServer.method_16208(MinecraftServer.java:758) ~[server-intermediary.jar:?] at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:687) ~[server-intermediary.jar:?] at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:270) ~[server-intermediary.jar:?] at java.lang.Thread.run(Thread.java:833) ~[?:?] [22:07:19] [Server thread/INFO]: Retidurc lost connection: Invalid player data [22:07:19] [Server thread/INFO]: Retidurc left the game

Otherwise, when removing the mod, everything works fine. On Minecraft 1.20.4 with Fabric Loader 0.15.6 No others mods except the fabric-api. I reseted the playerdata to see if it fixes the issue, but to no avail.

Retidurc commented 4 months ago

I found something else ! tl;dr : This bug might be a bad interaction with Bobby https://modrinth.com/mod/bobby https://github.com/Johni0702/bobby

And now for the proper explanation: The stack trace I posted earlier is a trace from the server I play on. When I tested to do this bug report, I deactivated everything on it,except Immersive portals. when I tried to login I had this exception happen and I assumed it was a server side bug.

This evening I took a look at your code by sheer curiosity, and the crash occurs due to this check : "Validate.isTrue(distanceToSource >= 0 && distanceToSource <= 32);" in ImmPtlChunkTickets.java I don't know why this check is needed, but It had me thinking "this look like it's checking for the vanilla max view distance", which is weird cause nothing changes it on the server..

Except the client I use to play on that server is also modded! And in that list of mods I have bobby.It is a client side mod which implement a client side cache of the chunks to allow for a greater view distance that what is normally allowed. This way, the client max view was set to 512.

When I try to login while the viewdistance is at the max vanilla distance, it's working normally, and I can connect without any problems.

I'm not sure to understand why a client side mod have any influence on the server side ImmersivePortal, but it's there.

Oh and there is something worse, if someone connect to a immersive portal server with bobby and immersive portal on their client, and a view distance within vanilla limits, the login works, but if they change their view distance over that, it crashes the whole server, not just that player.

[00:44:55] [Server thread/INFO]: Hey, I have a view distance of 30, let set it to 33 on my client [00:45:29] [Server thread/ERROR]: Encountered an unexpected exception java.lang.IllegalArgumentException: The validated expression is false at org.apache.commons.lang3.Validate.isTrue(Validate.java:180) ~[commons-lang3-3.13.0.jar:?] at qouteall.imm_ptl.core.chunk_loading.ImmPtlChunkTickets.markForLoading(ImmPtlChunkTickets.java:110) ~[immersive-portals-5.1.7-mc1.20.4-fabric.jar:?] at qouteall.imm_ptl.core.chunk_loading.ImmPtlChunkTracking.lambda$updateForPlayer$4(ImmPtlChunkTracking.java:196) ~[immersive-portals-5.1.7-mc1.20.4-fabric.jar:?] at qouteall.imm_ptl.core.chunk_loading.ChunkLoader.foreachChunkPos(ChunkLoader.java:51) ~[immersive-portals-5.1.7-mc1.20.4-fabric.jar:?] at qouteall.imm_ptl.core.chunk_loading.ImmPtlChunkTracking.updateForPlayer(ImmPtlChunkTracking.java:191) ~[immersive-portals-5.1.7-mc1.20.4-fabric.jar:?] at qouteall.imm_ptl.core.chunk_loading.ImmPtlChunkTracking.tick(ImmPtlChunkTracking.java:375) ~[immersive-portals-5.1.7-mc1.20.4-fabric.jar:?] at net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents.lambda$static$2(ServerTickEvents.java:43) ~[fabric-lifecycle-events-v1-2.3.0+a67ffb5d4f-2a1b6bd9185cd5c7.jar:?] at net.minecraft.server.MinecraftServer.handler$zjd001$fabric-lifecycle-events-v1$onEndTick(MinecraftServer.java:3434) ~[server-intermediary.jar:?] at net.minecraft.server.MinecraftServer.method_3748(MinecraftServer.java:874) ~[server-intermediary.jar:?] at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:683) ~[server-intermediary.jar:?] at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:270) ~[server-intermediary.jar:?] at java.lang.Thread.run(Thread.java:833) ~[?:?] [00:45:29] [Server thread/ERROR]: This crash report has been saved to: /srv/minecraft/aedras/./crash-reports/crash-2024-02-24_00.45.29-server.txt [00:45:29] [Server thread/INFO]: Stored 0 explosion event(s) to ./Aedras/./scheduled-explosions.json [00:45:29] [Server thread/INFO]: Stopping server [00:45:29] [Server thread/INFO]: Saving players [00:45:29] [Server thread/INFO]: Retidurc lost connection: Server closed [00:45:29] [Server thread/INFO]: Retidurc left the game [00:45:29] [Server thread/INFO]: Saving worlds [00:45:31] [Server thread/INFO]: Saving chunks for level 'ServerWorld minecraft:overworld Aedras'/minecraft:overworld

Once again I don't really understand why some purely client side changes can lead to a server crash, I guess it's some shenanigans specific to how your mod need both a server and client part to work.

qouteall commented 4 months ago

https://github.com/iPortalTeam/ImmersivePortalsMod/issues/953

Retidurc commented 4 months ago

Ah, didn't see there was already a bobby issue. Didn't realy searched for it since at first I thought it was a standalone issue.

Just so you know, I'll try to debug this particular issue on my side. At the very least to allow to connect without crashing the currently login player, or the whole server. This way he "urgent" issue of any client being able to crash an immersive portal server is corrected.

Retidurc commented 3 months ago

I did a little testing on my side, and since your commit here https://github.com/iPortalTeam/ImmersivePortalsMod/commit/a9be4291c3d81b131c5828cfb49274c5935a0af1 I've seen no more issues between your mod and bobby. Bobby has currently it's own set of issues making test a bit difficult, but the most important is that with this commit, bobby user can't crash a immersive portal server anymore. I'll do more extensive test when bobby fixes their issues, otherwise I think you can close this bug report when the next version of immersive portal goes live.