@@ -70,7 +70,6 @@ public abstract class MinecraftClientMixin {
70
70
71
71
@ Shadow @ Final public TextRenderer textRenderer ;
72
72
@ Shadow @ Final private Window window ;
73
- private boolean disconnectCheck = false ;
74
73
75
74
@ Inject (at = @ At ("HEAD" ), method = "createWorld" )
76
75
public void onCreate (String worldName , LevelInfo levelInfo , RegistryTracker .Modifiable registryTracker , GeneratorOptions generatorOptions , CallbackInfo ci ) {
@@ -86,7 +85,6 @@ public void onCreate(String worldName, LevelInfo levelInfo, RegistryTracker.Modi
86
85
InGameTimer .getInstance ().setCheatAvailable (levelInfo .areCommandsAllowed ());
87
86
InGameTimer .getInstance ().checkDifficulty (levelInfo .getDifficulty ());
88
87
InGameTimerUtils .IS_CHANGING_DIMENSION = true ;
89
- this .disconnectCheck = false ;
90
88
}
91
89
92
90
@ Inject (at = @ At ("HEAD" ), method = "startIntegratedServer(Ljava/lang/String;)V" )
@@ -100,14 +98,10 @@ public void onWorldOpen(String worldName, CallbackInfo ci) {
100
98
e .printStackTrace ();
101
99
}
102
100
InGameTimerUtils .IS_CHANGING_DIMENSION = true ;
103
- this .disconnectCheck = false ;
104
101
}
105
102
106
103
@ Inject (method = "openScreen" , at = @ At ("RETURN" ))
107
104
public void onSetScreen (Screen screen , CallbackInfo ci ) {
108
- if (screen instanceof LevelLoadingScreen ) {
109
- this .disconnectCheck = true ;
110
- }
111
105
if (InGameTimerClientUtils .FAILED_CATEGORY_INIT_SCREEN != null ) {
112
106
Screen screen1 = InGameTimerClientUtils .FAILED_CATEGORY_INIT_SCREEN ;
113
107
InGameTimerClientUtils .FAILED_CATEGORY_INIT_SCREEN = null ;
@@ -293,15 +287,18 @@ private static void onCrash(CrashReport crashReport, CallbackInfo ci) {
293
287
}
294
288
295
289
// Record save
296
- @ Inject (method = "stop" , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/client/MinecraftClient;close()V" , shift = At . Shift . BEFORE ))
290
+ @ Inject (method = "stop" , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/client/MinecraftClient;close()V" ))
297
291
public void onStop (CallbackInfo ci ) {
298
292
InGameTimer .getInstance ().writeRecordFile (false );
299
293
}
300
294
301
295
// Disconnecting fix
302
296
@ Inject (at = @ At ("HEAD" ), method = "disconnect(Lnet/minecraft/client/gui/screen/Screen;)V" )
303
297
public void disconnect (CallbackInfo ci ) {
304
- if (InGameTimer .getInstance ().getStatus () != TimerStatus .NONE && this .disconnectCheck ) {
298
+ // seedqueue suppresses disconnect calls for worlds in queue,
299
+ // and the client world is set after starting the server,
300
+ // which where the stray disconnect calls come from.
301
+ if (InGameTimer .getInstance ().getStatus () != TimerStatus .NONE && this .world != null ) {
305
302
GameInstance .getInstance ().callEvents ("leave_world" );
306
303
InGameTimer .leave ();
307
304
}
0 commit comments