diff options
author | extclp <2842417407@qq.com> | 2020-08-30 16:24:58 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-30 09:24:58 +0100 |
commit | 4f59483b8e337666363100e820f05e8e94be1523 (patch) | |
tree | decb16eea0b7c30284839ee8852881d59561ecf8 /spark-fabric/src | |
parent | e465d47bd93cbf4ffee8ac27200db0a64e064197 (diff) | |
download | spark-4f59483b8e337666363100e820f05e8e94be1523.tar.gz spark-4f59483b8e337666363100e820f05e8e94be1523.tar.bz2 spark-4f59483b8e337666363100e820f05e8e94be1523.zip |
fabric 1.16.2 (#69)
Diffstat (limited to 'spark-fabric/src')
-rw-r--r-- | spark-fabric/src/main/java/me/lucko/spark/fabric/FabricSparkMod.java | 7 | ||||
-rw-r--r-- | spark-fabric/src/main/java/me/lucko/spark/fabric/FabricTickHook.java | 16 |
2 files changed, 11 insertions, 12 deletions
diff --git a/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricSparkMod.java b/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricSparkMod.java index 780cedd..87fb214 100644 --- a/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricSparkMod.java +++ b/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricSparkMod.java @@ -23,7 +23,7 @@ package me.lucko.spark.fabric; import me.lucko.spark.fabric.plugin.FabricClientSparkPlugin; import me.lucko.spark.fabric.plugin.FabricServerSparkPlugin; import net.fabricmc.api.ModInitializer; -import net.fabricmc.fabric.api.event.server.ServerStartCallback; +import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.ModContainer; import net.minecraft.client.MinecraftClient; @@ -43,10 +43,9 @@ public class FabricSparkMod implements ModInitializer { FabricLoader loader = FabricLoader.getInstance(); this.container = loader.getModContainer("spark") .orElseThrow(() -> new IllegalStateException("Unable to get container for spark")); - this.configDirectory = loader.getConfigDirectory().toPath().resolve("spark"); - + this.configDirectory = loader.getConfigDir().resolve("spark"); // load hooks - ServerStartCallback.EVENT.register(server -> FabricServerSparkPlugin.register(this, server)); + ServerLifecycleEvents.SERVER_STARTING.register(server -> FabricServerSparkPlugin.register(this, server)); } // called be entrypoint defined in fabric.mod.json diff --git a/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricTickHook.java b/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricTickHook.java index 17c286f..9003091 100644 --- a/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricTickHook.java +++ b/spark-fabric/src/main/java/me/lucko/spark/fabric/FabricTickHook.java @@ -22,8 +22,8 @@ package me.lucko.spark.fabric; import me.lucko.spark.common.sampler.tick.AbstractTickHook; import me.lucko.spark.common.sampler.tick.TickHook; -import net.fabricmc.fabric.api.event.client.ClientTickCallback; -import net.fabricmc.fabric.api.event.server.ServerTickCallback; +import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; +import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; import net.minecraft.client.MinecraftClient; import net.minecraft.server.MinecraftServer; @@ -36,9 +36,9 @@ public abstract class FabricTickHook extends AbstractTickHook implements TickHoo this.closed = true; } - public static final class Server extends FabricTickHook implements ServerTickCallback { + public static final class Server extends FabricTickHook implements ServerTickEvents.EndTick { @Override - public void tick(MinecraftServer minecraftServer) { + public void onEndTick(MinecraftServer minecraftServer) { if (!this.closed) { onTick(); } @@ -46,13 +46,13 @@ public abstract class FabricTickHook extends AbstractTickHook implements TickHoo @Override public void start() { - ServerTickCallback.EVENT.register(this); + ServerTickEvents.END_SERVER_TICK.register(this); } } - public static final class Client extends FabricTickHook implements ClientTickCallback { + public static final class Client extends FabricTickHook implements ClientTickEvents.EndTick { @Override - public void tick(MinecraftClient minecraftClient) { + public void onEndTick(MinecraftClient minecraftClient) { if (!this.closed) { onTick(); } @@ -60,7 +60,7 @@ public abstract class FabricTickHook extends AbstractTickHook implements TickHoo @Override public void start() { - ClientTickCallback.EVENT.register(this); + ClientTickEvents.END_CLIENT_TICK.register(this); } } } |