Skip to content

Commit

Permalink
Add integrated server TPS reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
ah-OOG-ah committed Nov 20, 2024
1 parent df31108 commit d06d5b6
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public enum Mixins {
,"angelica.MixinEntityRenderer"
,"angelica.MixinGameSettings"
,"angelica.MixinMinecraft"
,"angelica.MixinMinecraftServer"
,"angelica.optimizations.MixinRendererLivingEntity"
,"angelica.MixinFMLClientHandler"
,"angelica.bugfixes.MixinRenderGlobal_DestroyBlock"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,9 @@ public void onRenderOverlay(RenderGameOverlayEvent.Text event) {
// Draw a frametime graph
if (((IGameSettingsExt)mc.gameSettings).angelica$showFpsGraph()) {
frametimeGraph.render();
tpsGraph.render();
if (Minecraft.getMinecraft().isSingleplayer()) {
tpsGraph.render();
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ public class MixinMinecraft {
private void angelica$trackFrametimes(CallbackInfo ci) {
long time = System.nanoTime();
AngelicaMod.proxy.putFrametime(time - angelica$lastFrameTime);
// testing
AngelicaMod.proxy.putTicktime(time - angelica$lastFrameTime);
angelica$lastFrameTime = time;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.gtnewhorizons.angelica.mixins.early.angelica;

import com.gtnewhorizons.angelica.AngelicaMod;
import com.llamalad7.mixinextras.sugar.Local;
import net.minecraft.server.MinecraftServer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(MinecraftServer.class)
public class MixinMinecraftServer {
@Inject(method = "tick", at = @At(value = "TAIL"))
private void angelica$trackTicktimes(CallbackInfo ci, @Local(ordinal = 0) long preTime) {
AngelicaMod.proxy.putTicktime(System.nanoTime() - preTime);
}
}

0 comments on commit d06d5b6

Please sign in to comment.