aboutsummaryrefslogtreecommitdiff
path: root/spark-forge/src/main/java/me/lucko/spark
diff options
context:
space:
mode:
authorLuck <git@lucko.me>2020-01-11 19:30:15 +0000
committerLuck <git@lucko.me>2020-01-11 19:30:15 +0000
commit2fe79f4140011f93df1567afcc9b75fababa187e (patch)
tree2a747c3da719d061302577b9cda422fe609ab636 /spark-forge/src/main/java/me/lucko/spark
parent9e066d1052643b2be270b4039a102260abb41ebb (diff)
downloadspark-2fe79f4140011f93df1567afcc9b75fababa187e.tar.gz
spark-2fe79f4140011f93df1567afcc9b75fababa187e.tar.bz2
spark-2fe79f4140011f93df1567afcc9b75fababa187e.zip
Add AbstractTickCounter
Diffstat (limited to 'spark-forge/src/main/java/me/lucko/spark')
-rw-r--r--spark-forge/src/main/java/me/lucko/spark/forge/ForgeTickCounter.java28
1 files changed, 3 insertions, 25 deletions
diff --git a/spark-forge/src/main/java/me/lucko/spark/forge/ForgeTickCounter.java b/spark-forge/src/main/java/me/lucko/spark/forge/ForgeTickCounter.java
index 2ff3f1d..7e387a7 100644
--- a/spark-forge/src/main/java/me/lucko/spark/forge/ForgeTickCounter.java
+++ b/spark-forge/src/main/java/me/lucko/spark/forge/ForgeTickCounter.java
@@ -20,20 +20,15 @@
package me.lucko.spark.forge;
+import me.lucko.spark.common.sampler.AbstractTickCounter;
import me.lucko.spark.common.sampler.TickCounter;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.TickEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
-import java.util.HashSet;
-import java.util.Set;
-
-public class ForgeTickCounter implements TickCounter {
+public class ForgeTickCounter extends AbstractTickCounter implements TickCounter {
private final TickEvent.Type type;
- private final Set<TickTask> tasks = new HashSet<>();
- private int tick = 0;
-
public ForgeTickCounter(TickEvent.Type type) {
this.type = type;
}
@@ -48,10 +43,7 @@ public class ForgeTickCounter implements TickCounter {
return;
}
- for (TickTask r : this.tasks){
- r.onTick(this);
- }
- this.tick++;
+ onTick();
}
@Override
@@ -64,18 +56,4 @@ public class ForgeTickCounter implements TickCounter {
MinecraftForge.EVENT_BUS.unregister(this);
}
- @Override
- public int getCurrentTick() {
- return this.tick;
- }
-
- @Override
- public void addTickTask(TickTask runnable) {
- this.tasks.add(runnable);
- }
-
- @Override
- public void removeTickTask(TickTask runnable) {
- this.tasks.remove(runnable);
- }
}