crash with Replay Mod
Opened this issue ยท 11 comments
steps to reproduce:
play your world (with recording enabled)
open Little chisel gui
exit world
play just recored replay
When it goes to the moment when gui was oppened it will crash.
crash-2018-05-20_02.39.18-client.txt
It doesnt crash with LittleTiles_v1.5.0-pre83_mc1.12.2. It just opens gui. It began to crash after updating LT (and CreativeCore)
Also, I tested several other mods' GUIs with Replay Mod and when playing replay they just dont open, so this most likely LittleTiles specific issue.
More spcifically it started to crash with addition of Layer Grid system - LittleTiles_v1.5.0-pre87_mc1.12.2 (didnt tried pre 84, not for 1.12)
To be honest I have no idea how the replay mod works and I'm not surprised by the fact that there are crashes. I don't plan to add support for it either, sorry :(
@Johni0702 How can I figure out whether a packet is recorded or send from the sever?
I'd generally discourage special casing this but if you must, iirc this is one way of checking whether a replay is currently active without depending on the ReplayMod directly:
boolean inReplay = !mc.isSingleplayer() && mc.getCurrentServerData() == null;
I'm not entirely sure if this is always false
for actual server connections all the time (specifically for the early packets, i.e. during forge handshake) but it definitely holds once the ClientConnectedToServerEvent
is emitted.
The ReplayMod works by recording and then, at a later point in time, replaying all packets coming from the server.
This becomes an issue when a mod doesn't expect a specific packet to arrive out of the blue and doesn't handle that case gracefully (which is actually surprisingly rare).
Here's an example of that:
- Player presses key
- Client opens GUI and sends packet to server
- Server sends response to update the GUI
- Client updates GUI it had previously opened
In a replay, steps 1 and 2 never happen and if the mod does 4 without verifying that the GUI is actually opened, it'll usually crash.
I suspect something similar is happening here. Your GUI system seems rather non-trivial to me which is why I wasn't able to find such a case.
Additionally we suppress various vanilla packets and overwrite the Player.openGui
method to prevent GUIs from opening during the replay. Just in case that's relevant for you.
The other major compatibility issue with the ReplayMod is that mods assume it's either Multiplayer or Integrated Server (e.g. when they try to determine a name for the current world; often an issue with mods which have per-world client-side settings) which just isn't the case in a replay. Afaict, that doesn't seem to be the issue here though.
Added it to my OpenGuiPacket, maybe that fixes the issue. Will be included in the next release.
Fix worked: it longer crashes and gui doesnt appear during replay. Thank you! ^_^
@kirokadura ;)