From d5e24ad2bbe5ec70c1247811e4d7bb62b7bc4080 Mon Sep 17 00:00:00 2001 From: TomTheFurry Date: Thu, 2 Jun 2022 12:57:32 +0800 Subject: [PATCH] Rework fabric hooks to use more fabric api if possible (Since, honestly, their hooks location is way better when it exists...) --- .../com/seibel/lod/core/api/internal/a7/ServerApi.java | 8 ++++++++ .../com/seibel/lod/core/api/internal/a7/SharedApi.java | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/main/java/com/seibel/lod/core/api/internal/a7/ServerApi.java b/src/main/java/com/seibel/lod/core/api/internal/a7/ServerApi.java index 0210843af..5362fd7c5 100644 --- a/src/main/java/com/seibel/lod/core/api/internal/a7/ServerApi.java +++ b/src/main/java/com/seibel/lod/core/api/internal/a7/ServerApi.java @@ -65,12 +65,14 @@ public class ServerApi } } + //TODO: rename to serverLoadEvent public void serverWorldLoadEvent() { Server server = new Server(); SharedApi.currentServer = server; SharedApi.currentWorld = new DHWorld(); } + //TODO: rename to serverUnloadEvent public void serverWorldUnloadEvent() { SharedApi.currentWorld.close(); SharedApi.currentWorld = null; @@ -83,9 +85,13 @@ public class ServerApi public void serverLevelUnloadEvent(IWorldWrapper world) { SharedApi.currentWorld.unloadLevel(world); } + + @Deprecated public void serverSaveEvent() { SharedApi.currentWorld.save(); } + + public void chunkSaveEvent(IChunkWrapper chunk, IWorldWrapper world) { //TODO @@ -93,4 +99,6 @@ public class ServerApi public void serverChunkLoadEvent(IChunkWrapper chunk, IWorldWrapper world) { } + public void serverChunkSaveEvent(IChunkWrapper chunk, IWorldWrapper world) { + } } diff --git a/src/main/java/com/seibel/lod/core/api/internal/a7/SharedApi.java b/src/main/java/com/seibel/lod/core/api/internal/a7/SharedApi.java index 36956f306..b2248d242 100644 --- a/src/main/java/com/seibel/lod/core/api/internal/a7/SharedApi.java +++ b/src/main/java/com/seibel/lod/core/api/internal/a7/SharedApi.java @@ -15,4 +15,6 @@ public class SharedApi { public static IMinecraftSharedWrapper MC; public static Logger LOGGER = DhLoggerBuilder.getLogger("DH Events"); + public static boolean inDedicatedEnvironment; + }