mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-01-09 00:40: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:
parent
5d473725d5
commit
064ff31830
@ -64,6 +64,9 @@ public final class ClientHooks {
|
||||
public static void onWorldUnload() {
|
||||
MonitorRenderState.destroyAll();
|
||||
SpeakerManager.reset();
|
||||
}
|
||||
|
||||
public static void onDisconnect() {
|
||||
ClientPocketComputers.reset();
|
||||
}
|
||||
|
||||
|
@ -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"))
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user