1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-01-09 08:50:29 +00:00

Don't reset client pocket state when changing level

As part of the multi-loader work, we unified some of our event listening
code (0908acbe9b). This incorrectly caused
client pocket computer state to be reset when the player changes
dimension, rather than when the player (dis)connects.

The server code isn't aware of this behaviour, and so does not resend
pocket computer state when the player moves level. We could change this,
but just fixing when we clear the pocket computer state is a much nicer
fix!

Fixes #2004
This commit is contained in:
Jonathan Coates 2024-10-31 09:33:22 +00:00
parent 5d473725d5
commit 064ff31830
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06
3 changed files with 8 additions and 0 deletions

View File

@ -64,6 +64,9 @@ public final class ClientHooks {
public static void onWorldUnload() {
MonitorRenderState.destroyAll();
SpeakerManager.reset();
}
public static void onDisconnect() {
ClientPocketComputers.reset();
}

View File

@ -28,6 +28,7 @@ class MinecraftMixin {
@SuppressWarnings("unused")
private void clearLevel(Screen screen, CallbackInfo ci) {
ClientHooks.onWorldUnload();
ClientHooks.onDisconnect();
}
@Inject(method = "setLevel", at = @At("HEAD"))

View File

@ -38,6 +38,10 @@ public final class ForgeClientHooks {
if (event.getLevel().isClientSide()) ClientHooks.onWorldUnload();
}
@SubscribeEvent
public static void onDisconnect(ClientPlayerNetworkEvent.LoggingOut event) {
ClientHooks.onDisconnect();
}
@SubscribeEvent
public static void drawHighlight(RenderHighlightEvent.Block event) {