From f5a07893211bd9522734c3ec4e63a73abcd80561 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Sat, 17 Jun 2023 12:01:23 -0500 Subject: [PATCH] Fix DhApiWorldProxy.getSinglePlayerLevel() --- .../com/seibel/lod/core/api/internal/SharedApi.java | 1 - .../com/seibel/lod/core/world/DhApiWorldProxy.java | 12 +++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/core/src/main/java/com/seibel/lod/core/api/internal/SharedApi.java b/core/src/main/java/com/seibel/lod/core/api/internal/SharedApi.java index a080e107b..2121d9618 100644 --- a/core/src/main/java/com/seibel/lod/core/api/internal/SharedApi.java +++ b/core/src/main/java/com/seibel/lod/core/api/internal/SharedApi.java @@ -11,7 +11,6 @@ import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftSharedWrapper; /** Contains code and variables used by both {@link ClientApi} and {@link ServerApi} */ public class SharedApi { - public static IMinecraftSharedWrapper MC; // TODO remove if possible, it is only used in one odd spot private static AbstractDhWorld currentWorld; diff --git a/core/src/main/java/com/seibel/lod/core/world/DhApiWorldProxy.java b/core/src/main/java/com/seibel/lod/core/world/DhApiWorldProxy.java index 74efcfda6..4ba01361f 100644 --- a/core/src/main/java/com/seibel/lod/core/world/DhApiWorldProxy.java +++ b/core/src/main/java/com/seibel/lod/core/world/DhApiWorldProxy.java @@ -6,14 +6,11 @@ import com.seibel.lod.api.interfaces.world.IDhApiWorldProxy; import com.seibel.lod.core.api.internal.SharedApi; import com.seibel.lod.core.dependencyInjection.SingletonInjector; import com.seibel.lod.core.level.IDhLevel; -import com.seibel.lod.core.logging.DhLoggerBuilder; import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper; +import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftSharedWrapper; import com.seibel.lod.core.wrapperInterfaces.world.ILevelWrapper; -import org.apache.logging.log4j.Logger; -import java.io.Closeable; import java.util.ArrayList; -import java.util.concurrent.CompletableFuture; /** * Used to interact with the currently loaded world. @@ -28,7 +25,8 @@ public class DhApiWorldProxy implements IDhApiWorldProxy { public static DhApiWorldProxy INSTANCE = new DhApiWorldProxy(); - private static final IMinecraftClientWrapper MC = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class); + private static final IMinecraftClientWrapper MC_CLIENT = SingletonInjector.INSTANCE.get(IMinecraftClientWrapper.class); + private static final IMinecraftSharedWrapper MC_SHARED = SingletonInjector.INSTANCE.get(IMinecraftSharedWrapper.class); private static final String NO_WORLD_EXCEPTION_STRING = "No world loaded"; @@ -49,9 +47,9 @@ public class DhApiWorldProxy implements IDhApiWorldProxy } - if (!SharedApi.MC.isDedicatedServer()) // TODO why isn't this thrown a null pointer? when is SharedApi.MC being set? + if (!MC_SHARED.isDedicatedServer()) { - return MC.getWrappedClientWorld(); + return MC_CLIENT.getWrappedClientWorld(); } else {