Remove unecessary looping inside Minecraft#runGameLoop
*/
package org.spongepowered.mod.mixin.core.client;
+import static net.minecraft.client.Minecraft.getSystemTime;
+
import net.minecraft.client.LoadingScreenRenderer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiOverlayDebug;
@Shadow private LanguageManager languageManager;
@Shadow private IntegratedServer integratedServer;
+ @Shadow private long debugUpdateTime;
+
private GuiOverlayDebug debugGui;
private Text kickMessage;
private boolean isNewSave;
@@ -157,4 +161,11 @@ public void onLoadWorld(LoadingScreenRenderer loadingScreen, String message) {
this.kickMessage = null;
}
}
+
+ // There's absolutely no reason to loop here. We force the loop
+ // to always exit after one interation by setting debugUpdateTime to getSystemTime()
+ @Redirect(method = "runGameLoop", at = @At(value = "FIELD", target = "Lnet/minecraft/client/Minecraft;debugUpdateTime:J", opcode = Opcodes.PUTFIELD))
+ public void onSetDebugUpdateTime(Minecraft this$0, long value) {
+ this.debugUpdateTime = getSystemTime();
+ }
}
