From 4a7af41397142a1f6965a2f3f264c24c215d75ae Mon Sep 17 00:00:00 2001 From: James Seibel Date: Thu, 24 Nov 2022 18:24:13 -0600 Subject: [PATCH] Put delayed objects in DhApiMain into a Delayed class also improve a few comments --- .../java/com/seibel/lod/api/DhApiMain.java | 66 ++++++++----------- .../java/com/seibel/lod/core/Initializer.java | 6 +- 2 files changed, 32 insertions(+), 40 deletions(-) diff --git a/api/src/main/java/com/seibel/lod/api/DhApiMain.java b/api/src/main/java/com/seibel/lod/api/DhApiMain.java index a11b15a97..b3ea13ae7 100644 --- a/api/src/main/java/com/seibel/lod/api/DhApiMain.java +++ b/api/src/main/java/com/seibel/lod/api/DhApiMain.java @@ -25,47 +25,35 @@ import com.seibel.lod.core.interfaces.dependencyInjection.IOverrideInjector; * the concrete object we replaced, there would be issues. * * @author James Seibel - * @version 2022-11-20 + * @version 2022-11-24 */ public class DhApiMain { - // only available after core initialization // - - /** - * WARNING: will be null until after DH initializes for the first time.

- * - * Use a {@link com.seibel.lod.api.methods.events.abstractEvents.DhApiAfterDhInitEvent DhApiAfterDhInitEvent} - * along with the {@link DhApiMain#events ApiCoreInjectors.events} to be notified when this can - * be safely used.

+ /** + * WARNING: + * All objects in this class will be null until after DH initializes for the first time.

* - * Used to interact with Distant Horizons' Configs. + * Bind a custom {@link com.seibel.lod.api.methods.events.abstractEvents.DhApiAfterDhInitEvent DhApiAfterDhInitEvent} + * to {@link DhApiMain#events ApiCoreInjectors.events} in order to be notified when this class can + * be safely used. */ - public static IDhApiConfig configs = null; - - /** - * WARNING: will be null until after DH initializes for the first time.

- * - * Use a {@link com.seibel.lod.api.methods.events.abstractEvents.DhApiAfterDhInitEvent DhApiAfterDhInitEvent} - * along with the {@link DhApiMain#events ApiCoreInjectors.events} to be notified when this can - * be safely used.

- * - * Used to interact with Distant Horizons' terrain data. - */ - public static IDhApiTerrainDataRepo terrainRepo = null; - - /** - * WARNING: will be null until after DH initializes for the first time.

- * - * Use a {@link com.seibel.lod.api.methods.events.abstractEvents.DhApiAfterDhInitEvent DhApiAfterDhInitEvent} - * along with the {@link DhApiMain#events ApiCoreInjectors.events} to be notified when this can - * be safely used.

- * - * Used to interact with Distant Horizons' currently loaded world and - * get levels to use with the {@link DhApiMain#terrainRepo}. - */ - public static IDhApiWorldProxy worldProxy = null; - - + public static class Delayed + { + /** Used to interact with Distant Horizons' Configs. */ + public static IDhApiConfig configs = null; + + /** + * Used to interact with Distant Horizons' terrain data. + * Designed to be used in conjunction with {@link DhApiMain.Delayed#worldProxy}. + */ + public static IDhApiTerrainDataRepo terrainRepo = null; + + /** + * Used to interact with Distant Horizons' currently loaded world. + * Designed to be used in conjunction with {@link DhApiMain.Delayed#terrainRepo}. + */ + public static IDhApiWorldProxy worldProxy = null; + } // always available // @@ -85,7 +73,11 @@ public class DhApiMain /** This version should be updated whenever new methods are added to the Distant Horizons API. */ public static int getApiMinorVersion() { return ModInfo.API_MINOR_VERSION; } - /** Returns the mod's version number in the format: Major.Minor.Patch */ + /** + * Returns the mod's semantic version number in the format: Major.Minor.Patch + * with optional extensions "-a" for alpha, "-b" for beta, and -dev for unstable development builds.
+ * Examples: "1.6.9-a", "1.7.0-a-dev", "2.1.0-b", "3.0.0", "3.1.4-dev" + */ public static String getModVersion() { return ModInfo.VERSION; } /** Returns true if the mod is a development version, false if it is a release version. */ public static boolean getIsDevVersion() { return ModInfo.IS_DEV_BUILD; } diff --git a/core/src/main/java/com/seibel/lod/core/Initializer.java b/core/src/main/java/com/seibel/lod/core/Initializer.java index bfa188fe2..4046186b3 100644 --- a/core/src/main/java/com/seibel/lod/core/Initializer.java +++ b/core/src/main/java/com/seibel/lod/core/Initializer.java @@ -25,9 +25,9 @@ public class Initializer SpottyDataLoader unused4 = new SpottyDataLoader(); // Auto register // link Core's config to the API - DhApiMain.configs = DhApiConfig.INSTANCE; - DhApiMain.terrainRepo = DhApiTerrainDataRepo.INSTANCE; - DhApiMain.worldProxy = DhApiWorldProxy.INSTANCE; + DhApiMain.Delayed.configs = DhApiConfig.INSTANCE; + DhApiMain.Delayed.terrainRepo = DhApiTerrainDataRepo.INSTANCE; + DhApiMain.Delayed.worldProxy = DhApiWorldProxy.INSTANCE; } }