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-forge1122/src/main/java/me | |
parent | c4f96ced241802e40076d704b8977e2b35aff2b6 (diff) | |
download | spark-65e216657e4ac86d4e1a1bee30033d9b27f5f217.tar.gz spark-65e216657e4ac86d4e1a1bee30033d9b27f5f217.tar.bz2 spark-65e216657e4ac86d4e1a1bee30033d9b27f5f217.zip |
Abstract tick reporter
Diffstat (limited to 'spark-forge1122/src/main/java/me')
-rw-r--r-- | spark-forge1122/src/main/java/me/lucko/spark/forge/Forge1122TickReporter.java | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/spark-forge1122/src/main/java/me/lucko/spark/forge/Forge1122TickReporter.java b/spark-forge1122/src/main/java/me/lucko/spark/forge/Forge1122TickReporter.java index 97698d4..cd2cfd8 100644 --- a/spark-forge1122/src/main/java/me/lucko/spark/forge/Forge1122TickReporter.java +++ b/spark-forge1122/src/main/java/me/lucko/spark/forge/Forge1122TickReporter.java @@ -20,18 +20,16 @@ package me.lucko.spark.forge; -import me.lucko.spark.common.tick.AbstractTickReporter; +import me.lucko.spark.common.tick.SimpleTickReporter; import me.lucko.spark.common.tick.TickReporter; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; -public class Forge1122TickReporter extends AbstractTickReporter implements TickReporter { +public class Forge1122TickReporter extends SimpleTickReporter implements TickReporter { private final TickEvent.Type type; - private long start = 0; - public Forge1122TickReporter(TickEvent.Type type) { this.type = type; } @@ -44,15 +42,10 @@ public class Forge1122TickReporter extends AbstractTickReporter implements TickR switch (e.phase) { case START: - this.start = System.nanoTime(); + onStart(); break; case END: - if (this.start == 0) { - return; - } - - double duration = (System.nanoTime() - this.start) / 1000000d; - onTick(duration); + onEnd(); break; default: throw new AssertionError(e.phase); @@ -67,6 +60,7 @@ public class Forge1122TickReporter extends AbstractTickReporter implements TickR @Override public void close() { MinecraftForge.EVENT_BUS.unregister(this); + super.close(); } } |