aboutsummaryrefslogtreecommitdiff
path: root/spark-forge/src/main/java
diff options
context:
space:
mode:
authorLuck <git@lucko.me>2018-12-19 14:07:01 +0000
committerLuck <git@lucko.me>2018-12-19 14:07:01 +0000
commit66a8afab99efb7ac7669961eb2e67e2244d494e5 (patch)
tree7930ab1768da5df81799995472292d73d6ce2647 /spark-forge/src/main/java
parentdb6ac9b36ae0242c53dc1452ac8fbc6cd7b748c2 (diff)
downloadspark-66a8afab99efb7ac7669961eb2e67e2244d494e5.tar.gz
spark-66a8afab99efb7ac7669961eb2e67e2244d494e5.tar.bz2
spark-66a8afab99efb7ac7669961eb2e67e2244d494e5.zip
Count current tick using an int instead of LongAdder
Assuming 20tps, there's enough space in an int to store a tick count spanning a number of years :)
Diffstat (limited to 'spark-forge/src/main/java')
-rw-r--r--spark-forge/src/main/java/me/lucko/spark/forge/ForgeSparkPlatform.java5
-rw-r--r--spark-forge/src/main/java/me/lucko/spark/forge/ForgeTickCounter.java9
2 files changed, 6 insertions, 8 deletions
diff --git a/spark-forge/src/main/java/me/lucko/spark/forge/ForgeSparkPlatform.java b/spark-forge/src/main/java/me/lucko/spark/forge/ForgeSparkPlatform.java
index 5b62f3f..f5a2c9e 100644
--- a/spark-forge/src/main/java/me/lucko/spark/forge/ForgeSparkPlatform.java
+++ b/spark-forge/src/main/java/me/lucko/spark/forge/ForgeSparkPlatform.java
@@ -27,7 +27,6 @@ import me.lucko.spark.sampler.ThreadDumper;
import net.kyori.text.TextComponent;
import net.kyori.text.serializer.ComponentSerializers;
-import net.minecraft.command.CommandException;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
@@ -90,7 +89,7 @@ public abstract class ForgeSparkPlatform extends SparkPlatform<ICommandSender> i
@Override
public void runAsync(Runnable r) {
- worker.execute(r);
+ this.worker.execute(r);
}
@Override
@@ -106,7 +105,7 @@ public abstract class ForgeSparkPlatform extends SparkPlatform<ICommandSender> i
}
@Override
- public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
+ public void execute(MinecraftServer server, ICommandSender sender, String[] args) {
if (!checkPermission(server, sender)) {
TextComponentString msg = new TextComponentString("You do not have permission to use this command.");
Style style = msg.getStyle();
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 97903ac..17f595b 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
@@ -28,13 +28,12 @@ import net.minecraftforge.fml.common.gameevent.TickEvent;
import java.util.HashSet;
import java.util.Set;
-import java.util.concurrent.atomic.LongAdder;
public class ForgeTickCounter implements TickCounter {
private final TickEvent.Type type;
private final Set<Runnable> tasks = new HashSet<>();
- private final LongAdder tick = new LongAdder();
+ private int tick = 0;
public ForgeTickCounter(TickEvent.Type type) {
this.type = type;
@@ -53,7 +52,7 @@ public class ForgeTickCounter implements TickCounter {
for (Runnable r : this.tasks){
r.run();
}
- this.tick.increment();
+ this.tick++;
}
@Override
@@ -67,8 +66,8 @@ public class ForgeTickCounter implements TickCounter {
}
@Override
- public long getCurrentTick() {
- return this.tick.longValue();
+ public int getCurrentTick() {
+ return this.tick;
}
@Override