diff options
author | Luck <git@lucko.me> | 2021-08-19 20:50:08 +0100 |
---|---|---|
committer | Luck <git@lucko.me> | 2021-08-19 20:50:15 +0100 |
commit | 65e216657e4ac86d4e1a1bee30033d9b27f5f217 (patch) | |
tree | 52d5b7f3abd5dd3e2f134a0c08aa2705effd6c5c /spark-fabric/src/main/java/me/lucko/spark | |
parent | c4f96ced241802e40076d704b8977e2b35aff2b6 (diff) | |
download | spark-65e216657e4ac86d4e1a1bee30033d9b27f5f217.tar.gz spark-65e216657e4ac86d4e1a1bee30033d9b27f5f217.tar.bz2 spark-65e216657e4ac86d4e1a1bee30033d9b27f5f217.zip |
Abstract tick reporter
Diffstat (limited to 'spark-fabric/src/main/java/me/lucko/spark')
-rw-r--r-- | spark-fabric/src/main/java/me/lucko/spark/fabric/FabricTickReporter.java | 33 |
1 files changed, 2 insertions, 31 deletions
diff --git a/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricTickReporter.java b/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricTickReporter.java index b581620..b71ac84 100644 --- a/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricTickReporter.java +++ b/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricTickReporter.java @@ -20,7 +20,7 @@ package me.lucko.spark.fabric; -import me.lucko.spark.common.tick.AbstractTickReporter; +import me.lucko.spark.common.tick.SimpleTickReporter; import me.lucko.spark.common.tick.TickReporter; import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; @@ -28,36 +28,7 @@ import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; import net.minecraft.client.MinecraftClient; import net.minecraft.server.MinecraftServer; -public abstract class FabricTickReporter extends AbstractTickReporter implements TickReporter { - private boolean closed = false; - - private long start = 0; - - protected void onStart() { - if (this.closed) { - return; - } - - this.start = System.nanoTime(); - } - - protected void onEnd() { - if (this.closed) { - return; - } - - if (this.start == 0) { - return; - } - - double duration = (System.nanoTime() - this.start) / 1000000d; - onTick(duration); - } - - @Override - public void close() { - this.closed = true; - } +public abstract class FabricTickReporter extends SimpleTickReporter implements TickReporter { public static final class Server extends FabricTickReporter implements ServerTickEvents.StartTick, ServerTickEvents.EndTick { @Override |