diff --git a/src/main/java/com/seibel/lod/core/ModInfo.java b/src/main/java/com/seibel/lod/core/ModInfo.java index 04b6cad7b..84d4f19bc 100644 --- a/src/main/java/com/seibel/lod/core/ModInfo.java +++ b/src/main/java/com/seibel/lod/core/ModInfo.java @@ -29,7 +29,7 @@ package com.seibel.lod.core; * * @author James Seibel * @author Ran - * @version 11-29-2021 + * @version 2022-4-25 */ public final class ModInfo { @@ -40,6 +40,11 @@ public final class ModInfo public static final String NAME = "DistantHorizons"; /** Human readable version of NAME */ public static final String READABLE_NAME = "Distant Horizons"; - public static final String API = "LodAPI"; public static final String VERSION = "1.7.0a-dev"; + + /** This version should only be updated when breaking changes are introduced to the DH API */ + public static final int API_MAJOR_VERSION = 1; + /** This version should be updated whenever new methods are added to the DH API */ + public static final int API_MINOR_VERSION = 1; + } diff --git a/src/main/java/com/seibel/lod/core/api/external/ApiMain.java b/src/main/java/com/seibel/lod/core/api/external/ApiMain.java new file mode 100644 index 000000000..f8f5ace49 --- /dev/null +++ b/src/main/java/com/seibel/lod/core/api/external/ApiMain.java @@ -0,0 +1,47 @@ +package com.seibel.lod.core.api.external; + +import com.seibel.lod.core.ModInfo; +import com.seibel.lod.core.handlers.LodDimensionFileHandler; + +/** + * This holds API methods related to version numbers and other unchanging endpoints. + * This shouldn't change between API versions. + * + * @author James Seibel + * @version 2022-4-26 + */ +public class ApiMain +{ + /** This version should only be updated when breaking changes are introduced to the DH API */ + public static int getApiMajorVersion() + { + return ModInfo.API_MAJOR_VERSION; + } + /** This version should be updated whenever new methods are added to the DH API */ + public static int getApiMinorVersion() + { + return ModInfo.API_MINOR_VERSION; + } + + /** Returns the mod's version number in the format: Major.Minor.Patch */ + 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 #if DEV_BUILD true; #else false; #endif + } + + /** Returns the network protocol version. */ + public static int getNetworkProtocolVersion() + { + return ModInfo.PROTOCOL_VERSION; + } + /** Returns the LOD file version. */ + public static int getLodFileFormatVersion() + { + return LodDimensionFileHandler.LOD_SAVE_FILE_VERSION; + } +} diff --git a/src/main/java/com/seibel/lod/core/api/external/ExternalApiShared.java b/src/main/java/com/seibel/lod/core/api/external/ExternalApiShared.java index 277f09140..39753c8a6 100644 --- a/src/main/java/com/seibel/lod/core/api/external/ExternalApiShared.java +++ b/src/main/java/com/seibel/lod/core/api/external/ExternalApiShared.java @@ -1,5 +1,8 @@ package com.seibel.lod.core.api.external; +import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler; +import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton; + /** * This stores objects and variables that * are shared between the different Core external api classes.

@@ -15,5 +18,7 @@ package com.seibel.lod.core.api.external; */ public class ExternalApiShared { - + public static final ILodConfigWrapperSingleton CONFIG = SingletonHandler.get(ILodConfigWrapperSingleton.class); + + } diff --git a/src/main/java/com/seibel/lod/core/api/external/config/client/Threading.java b/src/main/java/com/seibel/lod/core/api/external/config/client/Threading.java new file mode 100644 index 000000000..f4d0f1dd0 --- /dev/null +++ b/src/main/java/com/seibel/lod/core/api/external/config/client/Threading.java @@ -0,0 +1,40 @@ +package com.seibel.lod.core.api.external.config.client; + +import com.seibel.lod.core.api.external.ExternalApiShared; +import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton; + +/** + * General Threading settings. + * + * @author James Seibel + * @version 2022-4-26 + */ +public class Threading +{ + private static final ILodConfigWrapperSingleton.IClient.IAdvanced.IThreading threadSettings = ExternalApiShared.CONFIG.client().advanced().threading(); + + + /** Number of threads used to generate terrain outside the vanilla render distance. */ + public static int getNumberOfWorldGeneratorThreads_v1() + { + return threadSettings._getWorldGenerationThreadPoolSize(); + } + + /** + * Returns a number between 0.0 and 1.0. + * + * 0.0 = active 0% of the time + * 0.5 = active 50% of the time + * 1.0 = active 100% of the time + */ + public static double getWorldGeneratorThreadActivePercentage_v1() + { + return threadSettings._getWorldGenerationPartialRunTime(); + } + + /** Number of threads used to rebuild geometry data. */ + public static int getNumberOfBufferBuilderThreads_v1() + { + return threadSettings.getNumberOfBufferBuilderThreads(); + } +} diff --git a/src/main/java/com/seibel/lod/core/api/external/config/client/graphics/General.java b/src/main/java/com/seibel/lod/core/api/external/config/client/graphics/General.java new file mode 100644 index 000000000..ae31de8aa --- /dev/null +++ b/src/main/java/com/seibel/lod/core/api/external/config/client/graphics/General.java @@ -0,0 +1,28 @@ +package com.seibel.lod.core.api.external.config.client.graphics; + +import com.seibel.lod.core.api.external.ExternalApiShared; +import com.seibel.lod.core.enums.rendering.RendererType; +import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton; + +/** + * General graphics settings. + * + * @author James Seibel + * @version 2022-4-26 + */ +public class General +{ + private static final ILodConfigWrapperSingleton.IClient.IGraphics.IQuality qualitySettings = ExternalApiShared.CONFIG.client().graphics().quality(); + + + + public static int getLodChunkRenderDistance_v1() + { + return qualitySettings.getLodChunkRenderDistance(); + } + + public static boolean getRenderingEnabled_v1() + { + return ExternalApiShared.CONFIG.client().advanced().debugging().getRendererType() == RendererType.DEFAULT; + } +} diff --git a/src/main/java/com/seibel/lod/core/handlers/ReflectionHandler.java b/src/main/java/com/seibel/lod/core/handlers/ReflectionHandler.java index f18d58a43..69466ffa7 100644 --- a/src/main/java/com/seibel/lod/core/handlers/ReflectionHandler.java +++ b/src/main/java/com/seibel/lod/core/handlers/ReflectionHandler.java @@ -99,7 +99,7 @@ public class ReflectionHandler implements IReflectionHandler // we didn't find the field, // either optifine isn't installed, or // optifine changed the name of the variable - LOGGER.info(ReflectionHandler.class.getSimpleName() + ": unable to find the Optifine fog field. If Optifine isn't installed this can be ignored."); + LOGGER.info("Unable to find the Optifine fog field. If Optifine isn't installed this can be ignored."); }