From 0518b863cb855819c76b61e120fd81eb714eb835 Mon Sep 17 00:00:00 2001 From: Frederik van der Els Date: Tue, 4 Feb 2025 23:36:20 +0100 Subject: [PATCH 1/7] Add ctick command --- .../clientcommands/ClientCommands.java | 6 +- .../clientcommands/command/CTickCommand.java | 210 ++++++++++++++++++ .../assets/clientcommands/lang/en_us.json | 10 + 3 files changed, 224 insertions(+), 2 deletions(-) create mode 100644 src/main/java/net/earthcomputer/clientcommands/command/CTickCommand.java diff --git a/src/main/java/net/earthcomputer/clientcommands/ClientCommands.java b/src/main/java/net/earthcomputer/clientcommands/ClientCommands.java index db9a9b4e..008ea42a 100644 --- a/src/main/java/net/earthcomputer/clientcommands/ClientCommands.java +++ b/src/main/java/net/earthcomputer/clientcommands/ClientCommands.java @@ -11,10 +11,10 @@ import net.earthcomputer.clientcommands.event.ClientConnectionEvents; import net.earthcomputer.clientcommands.features.CommandExecutionCustomPayload; import net.earthcomputer.clientcommands.features.FishingCracker; -import net.earthcomputer.clientcommands.features.ServerBrandManager; -import net.earthcomputer.clientcommands.util.MappingsHelper; import net.earthcomputer.clientcommands.features.PlayerRandCracker; import net.earthcomputer.clientcommands.features.Relogger; +import net.earthcomputer.clientcommands.features.ServerBrandManager; +import net.earthcomputer.clientcommands.util.MappingsHelper; import net.fabricmc.api.ClientModInitializer; import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback; import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; @@ -74,6 +74,7 @@ public void onInitializeClient() { // Events ClientCommandRegistrationCallback.EVENT.register(ClientCommands::registerCommands); + CTickCommand.registerEvents(); FishingCracker.registerEvents(); PlayerRandCracker.registerEvents(); ServerBrandManager.registerEvents(); @@ -139,6 +140,7 @@ public static void registerCommands(CommandDispatcher CStopSoundCommand.register(dispatcher); CTeleportCommand.register(dispatcher); CTellRawCommand.register(dispatcher, context); + CTickCommand.register(dispatcher); CTimeCommand.register(dispatcher); CTitleCommand.register(dispatcher, context); FindBlockCommand.register(dispatcher, context); diff --git a/src/main/java/net/earthcomputer/clientcommands/command/CTickCommand.java b/src/main/java/net/earthcomputer/clientcommands/command/CTickCommand.java new file mode 100644 index 00000000..b096e212 --- /dev/null +++ b/src/main/java/net/earthcomputer/clientcommands/command/CTickCommand.java @@ -0,0 +1,210 @@ +package net.earthcomputer.clientcommands.command; + +import com.mojang.brigadier.CommandDispatcher; +import com.mojang.brigadier.exceptions.CommandSyntaxException; +import net.earthcomputer.clientcommands.event.MoreClientEvents; +import net.earthcomputer.clientcommands.task.SimpleTask; +import net.earthcomputer.clientcommands.task.TaskManager; +import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; +import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; +import net.minecraft.client.Minecraft; +import net.minecraft.network.chat.Component; +import net.minecraft.network.protocol.game.ClientboundSetTimePacket; +import net.minecraft.util.TimeUtil; + +import java.text.DecimalFormat; + +import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.*; + +public class CTickCommand { + + private static final DecimalFormat DEC_FMT = new DecimalFormat("0.00"); + + private static final String TASK_NAME = "ctick"; + + private static TickMeasuringTask currentMeasurer = null; + + public static void register(CommandDispatcher dispatcher) { + dispatcher.register(literal("ctick") + .then(literal("client") + .then(literal("tps") + .executes(ctx -> getTpsClient(ctx.getSource()))) + .then(literal("mspt") + .executes(ctx -> getMsptClient(ctx.getSource())))) + .then(literal("server") + .then(literal("tps") + .executes(ctx -> getTpsServer(ctx.getSource()))) + .then(literal("mspt") + .executes(ctx -> getMsptServer(ctx.getSource()))))); + } + + private static int getTpsClient(FabricClientCommandSource source) throws CommandSyntaxException { + stopPreviousTask(); + + TickMeasuringTask measurer = new TickMeasuringTask(true, false); + TaskManager.addTask(TASK_NAME, measurer); + currentMeasurer = measurer; + + float tps = source.getWorld().tickRateManager().tickrate(); + source.sendFeedback(Component.translatable("commands.ctick.client.tps.expectedTps", tps)); + return (int) tps; + } + + private static int getMsptClient(FabricClientCommandSource source) throws CommandSyntaxException { + stopPreviousTask(); + + TickMeasuringTask measurer = new TickMeasuringTask(false, false); + TaskManager.addTask(TASK_NAME, measurer); + currentMeasurer = measurer; + + float mspt = TimeUtil.MILLISECONDS_PER_SECOND / source.getWorld().tickRateManager().tickrate(); + source.sendFeedback(Component.translatable("commands.ctick.client.mspt.expectedMspt", mspt)); + return (int) mspt; + } + + private static int getTpsServer(FabricClientCommandSource source) throws CommandSyntaxException { + stopPreviousTask(); + + boolean isIntegratedServer = source.getClient().hasSingleplayerServer(); + TickMeasuringTask measurer = new TickMeasuringTask(true, !isIntegratedServer); + TaskManager.addTask(TASK_NAME, measurer); + currentMeasurer = measurer; + + float tps = source.getWorld().tickRateManager().tickrate(); + source.sendFeedback(Component.translatable("commands.ctick.server.tps.expectedTps", tps)); + return (int) tps; + } + + private static int getMsptServer(FabricClientCommandSource source) throws CommandSyntaxException { + stopPreviousTask(); + + boolean isIntegratedServer = source.getClient().hasSingleplayerServer(); + TickMeasuringTask measurer = new TickMeasuringTask(false, !isIntegratedServer); + TaskManager.addTask(TASK_NAME, measurer); + currentMeasurer = measurer; + + float mspt = TimeUtil.MILLISECONDS_PER_SECOND / source.getWorld().tickRateManager().tickrate(); + source.sendFeedback(Component.translatable("commands.ctick.server.mspt.expectedMspt", mspt)); + return (int) mspt; + } + + private static void stopPreviousTask() { + if (currentMeasurer != null) { + currentMeasurer._break(); + TaskManager.removeTask(TASK_NAME); + currentMeasurer = null; + } + } + + // see https://github.com/Earthcomputer/clientcommands/blob/c1e37665739f0e1d6aeb826b9d4e45b7adb5d876/src/main/java/net/earthcomputer/clientcommands/command/CommandTick.java#L175-L255 + private static class TickMeasuringTask extends SimpleTask { + + private static final int PERIOD = 100; + + private static final Minecraft minecraft = Minecraft.getInstance(); + + private int tickCount = 0; + private long totalTickTime = 0; + private long startTickTime; + private boolean hadFirstTick = false; + private long firstTickStart; + private long lastTickStart; + + private final boolean tps; + private final boolean forceInaccurate; + + public TickMeasuringTask(boolean tps, boolean forceInaccurate) { + this.tps = tps; + this.forceInaccurate = forceInaccurate; + } + + public void incrTickCount(int count) { + if (!hadFirstTick) { + firstTickStart = System.nanoTime(); + hadFirstTick = true; + } else { + tickCount += count; + } + } + + public void startTick() { + startTickTime = System.nanoTime(); + if (!hadFirstTick) { + firstTickStart = startTickTime; + hadFirstTick = true; + } + } + + public void endTick() { + if (hadFirstTick) { + totalTickTime += System.nanoTime() - startTickTime; + tickCount++; + } + } + + @Override + protected void onTick() { + if (tickCount >= PERIOD) { + lastTickStart = System.nanoTime(); + _break(); + } + } + + @Override + public void initialize() { + minecraft.player.displayClientMessage(Component.translatable("commands.ctick.measuring"), false); + } + + @Override + public void onCompleted() { + if (tps) { + long totalTime = lastTickStart - firstTickStart; + double tps = 1_000_000_000D * tickCount / totalTime; + minecraft.player.displayClientMessage(Component.translatable("commands.ctick.tps", totalTime == 0 ? Component.translatable("commands.ctick.tps.immeasurable") : DEC_FMT.format(tps)), false); + } else if (forceInaccurate) { + long totalTime = lastTickStart - firstTickStart; + double mspt = totalTime / (1_000_000D * tickCount); + minecraft.player.displayClientMessage(Component.translatable("commands.ctick.mspt", DEC_FMT.format(mspt)), false); + minecraft.player.displayClientMessage(Component.translatable("commands.ctick.mspt.inaccurate"), false); + } else { + double mspt = totalTickTime / (1_000_000D * tickCount); + minecraft.player.displayClientMessage(Component.translatable("commands.ctick.mspt", DEC_FMT.format(mspt)), false); + } + } + + @Override + public boolean condition() { + return tickCount <= 1200; + } + } + + public static void registerEvents() { + ClientTickEvents.START_CLIENT_TICK.register(minecraft -> { + if (currentMeasurer != null && !currentMeasurer.isCompleted() && !currentMeasurer.forceInaccurate) { + currentMeasurer.startTick(); + } + }); + + ClientTickEvents.END_CLIENT_TICK.register(minecraft -> { + if (currentMeasurer != null && !currentMeasurer.isCompleted() && !currentMeasurer.forceInaccurate) { + currentMeasurer.endTick(); + } + }); + + MoreClientEvents.TIME_SYNC.register(new MoreClientEvents.TimeSync() { + private long lastTick = -1; + + @Override + public void onTimeSync(ClientboundSetTimePacket packet) { + if (currentMeasurer != null && !currentMeasurer.isCompleted() && currentMeasurer.forceInaccurate) { + long tick = packet.gameTime(); + if (lastTick != -1) { + int deltaTick = (int) (tick - lastTick); + currentMeasurer.incrTickCount(deltaTick); + } + lastTick = tick; + } + } + }); + } +} diff --git a/src/main/resources/assets/clientcommands/lang/en_us.json b/src/main/resources/assets/clientcommands/lang/en_us.json index 6e1d6af7..54f0d216 100644 --- a/src/main/resources/assets/clientcommands/lang/en_us.json +++ b/src/main/resources/assets/clientcommands/lang/en_us.json @@ -249,6 +249,16 @@ "commands.ctask.stop.noMatch": "No matching tasks", "commands.ctask.stop.success": "Stopped %s tasks", + "commands.ctick.client.mspt.expectedMspt": "The expected client MSPT is %s", + "commands.ctick.client.tps.expectedTps": "The expected client TPS is %s", + "commands.ctick.measuring": "Measuring...", + "commands.ctick.mspt": "Milliseconds per tick = %s", + "commands.ctick.mspt.inaccurate": "MSPT is inaccurate above 20TPS", + "commands.ctick.server.mspt.expectedMspt": "The expected server MSPT is %s", + "commands.ctick.server.tps.expectedTps": "The expected server TPS is %s", + "commands.ctick.tps": "Ticks per second = %s", + "commands.ctick.tps.immeasurable": "Immeasurable", + "commands.ctictactoe.name": "Tic-tac-toe", "commands.ctime.reset.success": "The time now matches the server", From a7a1fdf161feeecd3c2a69b4982f1f1b66eeed6c Mon Sep 17 00:00:00 2001 From: Frederik van der Els Date: Tue, 4 Feb 2025 23:41:29 +0100 Subject: [PATCH 2/7] Be consistent in naming --- .../clientcommands/command/CTickCommand.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/earthcomputer/clientcommands/command/CTickCommand.java b/src/main/java/net/earthcomputer/clientcommands/command/CTickCommand.java index b096e212..b05697d8 100644 --- a/src/main/java/net/earthcomputer/clientcommands/command/CTickCommand.java +++ b/src/main/java/net/earthcomputer/clientcommands/command/CTickCommand.java @@ -28,17 +28,17 @@ public static void register(CommandDispatcher dispatc dispatcher.register(literal("ctick") .then(literal("client") .then(literal("tps") - .executes(ctx -> getTpsClient(ctx.getSource()))) + .executes(ctx -> getClientTps(ctx.getSource()))) .then(literal("mspt") - .executes(ctx -> getMsptClient(ctx.getSource())))) + .executes(ctx -> getClientMspt(ctx.getSource())))) .then(literal("server") .then(literal("tps") - .executes(ctx -> getTpsServer(ctx.getSource()))) + .executes(ctx -> getServerTps(ctx.getSource()))) .then(literal("mspt") - .executes(ctx -> getMsptServer(ctx.getSource()))))); + .executes(ctx -> getServerMspt(ctx.getSource()))))); } - private static int getTpsClient(FabricClientCommandSource source) throws CommandSyntaxException { + private static int getClientTps(FabricClientCommandSource source) throws CommandSyntaxException { stopPreviousTask(); TickMeasuringTask measurer = new TickMeasuringTask(true, false); @@ -50,7 +50,7 @@ private static int getTpsClient(FabricClientCommandSource source) throws Command return (int) tps; } - private static int getMsptClient(FabricClientCommandSource source) throws CommandSyntaxException { + private static int getClientMspt(FabricClientCommandSource source) throws CommandSyntaxException { stopPreviousTask(); TickMeasuringTask measurer = new TickMeasuringTask(false, false); @@ -62,7 +62,7 @@ private static int getMsptClient(FabricClientCommandSource source) throws Comman return (int) mspt; } - private static int getTpsServer(FabricClientCommandSource source) throws CommandSyntaxException { + private static int getServerTps(FabricClientCommandSource source) throws CommandSyntaxException { stopPreviousTask(); boolean isIntegratedServer = source.getClient().hasSingleplayerServer(); @@ -75,7 +75,7 @@ private static int getTpsServer(FabricClientCommandSource source) throws Command return (int) tps; } - private static int getMsptServer(FabricClientCommandSource source) throws CommandSyntaxException { + private static int getServerMspt(FabricClientCommandSource source) throws CommandSyntaxException { stopPreviousTask(); boolean isIntegratedServer = source.getClient().hasSingleplayerServer(); From 1bc0636d5f373d3d7539beab7bef6d330474cabe Mon Sep 17 00:00:00 2001 From: Frederik van der Els <49305700+xpple@users.noreply.github.com> Date: Thu, 6 Feb 2025 22:03:40 +0100 Subject: [PATCH 3/7] Update translation Co-authored-by: Joseph Burton --- src/main/resources/assets/clientcommands/lang/en_us.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/assets/clientcommands/lang/en_us.json b/src/main/resources/assets/clientcommands/lang/en_us.json index 54f0d216..ee6e99ca 100644 --- a/src/main/resources/assets/clientcommands/lang/en_us.json +++ b/src/main/resources/assets/clientcommands/lang/en_us.json @@ -253,7 +253,7 @@ "commands.ctick.client.tps.expectedTps": "The expected client TPS is %s", "commands.ctick.measuring": "Measuring...", "commands.ctick.mspt": "Milliseconds per tick = %s", - "commands.ctick.mspt.inaccurate": "MSPT is inaccurate above 20TPS", + "commands.ctick.mspt.inaccurate": "MSPT is inaccurate when the server isn't lagging", "commands.ctick.server.mspt.expectedMspt": "The expected server MSPT is %s", "commands.ctick.server.tps.expectedTps": "The expected server TPS is %s", "commands.ctick.tps": "Ticks per second = %s", From 8845baffe3a1dbb7bd65b81441480515bc4fd9f0 Mon Sep 17 00:00:00 2001 From: Frederik van der Els Date: Thu, 6 Feb 2025 22:09:04 +0100 Subject: [PATCH 4/7] Fix removing the previous task --- .../clientcommands/command/CTickCommand.java | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/src/main/java/net/earthcomputer/clientcommands/command/CTickCommand.java b/src/main/java/net/earthcomputer/clientcommands/command/CTickCommand.java index b05697d8..9761b013 100644 --- a/src/main/java/net/earthcomputer/clientcommands/command/CTickCommand.java +++ b/src/main/java/net/earthcomputer/clientcommands/command/CTickCommand.java @@ -22,7 +22,7 @@ public class CTickCommand { private static final String TASK_NAME = "ctick"; - private static TickMeasuringTask currentMeasurer = null; + private static CurrentTask currentTask = null; public static void register(CommandDispatcher dispatcher) { dispatcher.register(literal("ctick") @@ -42,8 +42,8 @@ private static int getClientTps(FabricClientCommandSource source) throws Command stopPreviousTask(); TickMeasuringTask measurer = new TickMeasuringTask(true, false); - TaskManager.addTask(TASK_NAME, measurer); - currentMeasurer = measurer; + String name = TaskManager.addTask(TASK_NAME, measurer); + currentTask = new CurrentTask(name, measurer); float tps = source.getWorld().tickRateManager().tickrate(); source.sendFeedback(Component.translatable("commands.ctick.client.tps.expectedTps", tps)); @@ -54,8 +54,8 @@ private static int getClientMspt(FabricClientCommandSource source) throws Comman stopPreviousTask(); TickMeasuringTask measurer = new TickMeasuringTask(false, false); - TaskManager.addTask(TASK_NAME, measurer); - currentMeasurer = measurer; + String name = TaskManager.addTask(TASK_NAME, measurer); + currentTask = new CurrentTask(name, measurer); float mspt = TimeUtil.MILLISECONDS_PER_SECOND / source.getWorld().tickRateManager().tickrate(); source.sendFeedback(Component.translatable("commands.ctick.client.mspt.expectedMspt", mspt)); @@ -67,8 +67,8 @@ private static int getServerTps(FabricClientCommandSource source) throws Command boolean isIntegratedServer = source.getClient().hasSingleplayerServer(); TickMeasuringTask measurer = new TickMeasuringTask(true, !isIntegratedServer); - TaskManager.addTask(TASK_NAME, measurer); - currentMeasurer = measurer; + String name = TaskManager.addTask(TASK_NAME, measurer); + currentTask = new CurrentTask(name, measurer); float tps = source.getWorld().tickRateManager().tickrate(); source.sendFeedback(Component.translatable("commands.ctick.server.tps.expectedTps", tps)); @@ -80,8 +80,8 @@ private static int getServerMspt(FabricClientCommandSource source) throws Comman boolean isIntegratedServer = source.getClient().hasSingleplayerServer(); TickMeasuringTask measurer = new TickMeasuringTask(false, !isIntegratedServer); - TaskManager.addTask(TASK_NAME, measurer); - currentMeasurer = measurer; + String name = TaskManager.addTask(TASK_NAME, measurer); + currentTask = new CurrentTask(name, measurer); float mspt = TimeUtil.MILLISECONDS_PER_SECOND / source.getWorld().tickRateManager().tickrate(); source.sendFeedback(Component.translatable("commands.ctick.server.mspt.expectedMspt", mspt)); @@ -89,10 +89,9 @@ private static int getServerMspt(FabricClientCommandSource source) throws Comman } private static void stopPreviousTask() { - if (currentMeasurer != null) { - currentMeasurer._break(); - TaskManager.removeTask(TASK_NAME); - currentMeasurer = null; + if (currentTask != null) { + TaskManager.removeTask(currentTask.name); + currentTask = null; } } @@ -180,14 +179,14 @@ public boolean condition() { public static void registerEvents() { ClientTickEvents.START_CLIENT_TICK.register(minecraft -> { - if (currentMeasurer != null && !currentMeasurer.isCompleted() && !currentMeasurer.forceInaccurate) { - currentMeasurer.startTick(); + if (currentTask != null && !currentTask.measurer.isCompleted() && !currentTask.measurer.forceInaccurate) { + currentTask.measurer.startTick(); } }); ClientTickEvents.END_CLIENT_TICK.register(minecraft -> { - if (currentMeasurer != null && !currentMeasurer.isCompleted() && !currentMeasurer.forceInaccurate) { - currentMeasurer.endTick(); + if (currentTask != null && !currentTask.measurer.isCompleted() && !currentTask.measurer.forceInaccurate) { + currentTask.measurer.endTick(); } }); @@ -196,15 +195,18 @@ public static void registerEvents() { @Override public void onTimeSync(ClientboundSetTimePacket packet) { - if (currentMeasurer != null && !currentMeasurer.isCompleted() && currentMeasurer.forceInaccurate) { + if (currentTask != null && !currentTask.measurer.isCompleted() && currentTask.measurer.forceInaccurate) { long tick = packet.gameTime(); if (lastTick != -1) { int deltaTick = (int) (tick - lastTick); - currentMeasurer.incrTickCount(deltaTick); + currentTask.measurer.incrTickCount(deltaTick); } lastTick = tick; } } }); } + + private record CurrentTask(String name, TickMeasuringTask measurer) { + } } From a61803f09c0371ec168385e9765415661b1aefed Mon Sep 17 00:00:00 2001 From: Frederik van der Els Date: Thu, 6 Feb 2025 22:10:10 +0100 Subject: [PATCH 5/7] Use ClientCommandHelper.sendFeedback --- .../clientcommands/command/CTickCommand.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/earthcomputer/clientcommands/command/CTickCommand.java b/src/main/java/net/earthcomputer/clientcommands/command/CTickCommand.java index 9761b013..73bf0f89 100644 --- a/src/main/java/net/earthcomputer/clientcommands/command/CTickCommand.java +++ b/src/main/java/net/earthcomputer/clientcommands/command/CTickCommand.java @@ -7,7 +7,6 @@ import net.earthcomputer.clientcommands.task.TaskManager; import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; -import net.minecraft.client.Minecraft; import net.minecraft.network.chat.Component; import net.minecraft.network.protocol.game.ClientboundSetTimePacket; import net.minecraft.util.TimeUtil; @@ -100,8 +99,6 @@ private static class TickMeasuringTask extends SimpleTask { private static final int PERIOD = 100; - private static final Minecraft minecraft = Minecraft.getInstance(); - private int tickCount = 0; private long totalTickTime = 0; private long startTickTime; @@ -151,7 +148,7 @@ protected void onTick() { @Override public void initialize() { - minecraft.player.displayClientMessage(Component.translatable("commands.ctick.measuring"), false); + ClientCommandHelper.sendFeedback(Component.translatable("commands.ctick.measuring")); } @Override @@ -159,15 +156,15 @@ public void onCompleted() { if (tps) { long totalTime = lastTickStart - firstTickStart; double tps = 1_000_000_000D * tickCount / totalTime; - minecraft.player.displayClientMessage(Component.translatable("commands.ctick.tps", totalTime == 0 ? Component.translatable("commands.ctick.tps.immeasurable") : DEC_FMT.format(tps)), false); + ClientCommandHelper.sendFeedback(Component.translatable("commands.ctick.tps", totalTime == 0 ? Component.translatable("commands.ctick.tps.immeasurable") : DEC_FMT.format(tps))); } else if (forceInaccurate) { long totalTime = lastTickStart - firstTickStart; double mspt = totalTime / (1_000_000D * tickCount); - minecraft.player.displayClientMessage(Component.translatable("commands.ctick.mspt", DEC_FMT.format(mspt)), false); - minecraft.player.displayClientMessage(Component.translatable("commands.ctick.mspt.inaccurate"), false); + ClientCommandHelper.sendFeedback(Component.translatable("commands.ctick.mspt", DEC_FMT.format(mspt))); + ClientCommandHelper.sendFeedback(Component.translatable("commands.ctick.mspt.inaccurate")); } else { double mspt = totalTickTime / (1_000_000D * tickCount); - minecraft.player.displayClientMessage(Component.translatable("commands.ctick.mspt", DEC_FMT.format(mspt)), false); + ClientCommandHelper.sendFeedback(Component.translatable("commands.ctick.mspt", DEC_FMT.format(mspt))); } } From a81606506f97f44fdcfd1532350bb7f1e57d1593 Mon Sep 17 00:00:00 2001 From: Frederik van der Els Date: Thu, 6 Feb 2025 22:11:18 +0100 Subject: [PATCH 6/7] Use ClientCommandHelper.sendHelp --- .../net/earthcomputer/clientcommands/command/CTickCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/earthcomputer/clientcommands/command/CTickCommand.java b/src/main/java/net/earthcomputer/clientcommands/command/CTickCommand.java index 73bf0f89..b00d5eab 100644 --- a/src/main/java/net/earthcomputer/clientcommands/command/CTickCommand.java +++ b/src/main/java/net/earthcomputer/clientcommands/command/CTickCommand.java @@ -161,7 +161,7 @@ public void onCompleted() { long totalTime = lastTickStart - firstTickStart; double mspt = totalTime / (1_000_000D * tickCount); ClientCommandHelper.sendFeedback(Component.translatable("commands.ctick.mspt", DEC_FMT.format(mspt))); - ClientCommandHelper.sendFeedback(Component.translatable("commands.ctick.mspt.inaccurate")); + ClientCommandHelper.sendHelp(Component.translatable("commands.ctick.mspt.inaccurate")); } else { double mspt = totalTickTime / (1_000_000D * tickCount); ClientCommandHelper.sendFeedback(Component.translatable("commands.ctick.mspt", DEC_FMT.format(mspt))); From 9217766ec7685cbf91625b184bf927ed109a6c91 Mon Sep 17 00:00:00 2001 From: Frederik van der Els Date: Thu, 6 Feb 2025 22:12:27 +0100 Subject: [PATCH 7/7] Remove comment --- .../net/earthcomputer/clientcommands/command/CTickCommand.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/net/earthcomputer/clientcommands/command/CTickCommand.java b/src/main/java/net/earthcomputer/clientcommands/command/CTickCommand.java index b00d5eab..230a48c3 100644 --- a/src/main/java/net/earthcomputer/clientcommands/command/CTickCommand.java +++ b/src/main/java/net/earthcomputer/clientcommands/command/CTickCommand.java @@ -94,7 +94,6 @@ private static void stopPreviousTask() { } } - // see https://github.com/Earthcomputer/clientcommands/blob/c1e37665739f0e1d6aeb826b9d4e45b7adb5d876/src/main/java/net/earthcomputer/clientcommands/command/CommandTick.java#L175-L255 private static class TickMeasuringTask extends SimpleTask { private static final int PERIOD = 100;