Add support for different Core behavior in different MC versions

This commit is contained in:
James Seibel
2021-12-11 21:40:53 -06:00
parent df28d2dc9d
commit 7c8b7f00e6
4 changed files with 53 additions and 4 deletions
+1 -1
Submodule core updated: c1375f7a10...acc5e7af98
@@ -51,6 +51,7 @@ import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.I
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IGraphics.IFogQuality;
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IGraphics.IQuality;
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton.IClient.IWorldGenerator;
import com.seibel.lod.forge.wrappers.VersionConstants;
import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.eventbus.api.SubscribeEvent;
@@ -61,7 +62,7 @@ import net.minecraftforge.fml.config.ModConfig;
* This handles any configuration the user has access to.
* @author Leonardo Amato
* @author James Seibel
* @version 12-1-2021
* @version 12-11-2021
*/
@Mod.EventBusSubscriber
public class ForgeConfig
@@ -270,7 +271,7 @@ public class ForgeConfig
distanceGenerationMode = builder
.comment("\n\n"
+ IWorldGenerator.DISTANCE_GENERATION_MODE_DESC)
+ IWorldGenerator.getDistanceGenerationModeDesc(VersionConstants.INSTANCE))
.defineEnum("Distance Generation Mode", IWorldGenerator.DISTANCE_GENERATION_MODE_DEFAULT);
allowUnstableFeatureGeneration = builder
@@ -3,6 +3,7 @@ package com.seibel.lod.forge.wrappers;
import com.seibel.lod.core.handlers.IReflectionHandler;
import com.seibel.lod.core.handlers.ReflectionHandler;
import com.seibel.lod.core.util.SingletonHandler;
import com.seibel.lod.core.wrapperInterfaces.IVersionConstants;
import com.seibel.lod.core.wrapperInterfaces.IWrapperFactory;
import com.seibel.lod.core.wrapperInterfaces.block.IBlockColorSingletonWrapper;
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
@@ -20,7 +21,7 @@ import com.seibel.lod.forge.wrappers.minecraft.MinecraftWrapper;
* are loaded.
*
* @author James Seibel
* @version 11-20-2021
* @version 12-11-2021
*/
public class ForgeDependencySetup
{
@@ -31,6 +32,7 @@ public class ForgeDependencySetup
SingletonHandler.bind(IMinecraftWrapper.class, MinecraftWrapper.INSTANCE);
SingletonHandler.bind(IMinecraftRenderWrapper.class, MinecraftRenderWrapper.INSTANCE);
SingletonHandler.bind(IWrapperFactory.class, WrapperFactory.INSTANCE);
SingletonHandler.bind(IVersionConstants.class, VersionConstants.INSTANCE);
SingletonHandler.bind(IReflectionHandler.class, ReflectionHandler.createSingleton(MinecraftWrapper.INSTANCE.getOptions().getClass().getDeclaredFields(), MinecraftWrapper.INSTANCE.getOptions()));
}
@@ -0,0 +1,46 @@
package com.seibel.lod.forge.wrappers;
import com.seibel.lod.core.enums.config.DistanceGenerationMode;
import com.seibel.lod.core.wrapperInterfaces.IVersionConstants;
/**
* @author James Seibel
* @version 12-11-2021
*/
public class VersionConstants implements IVersionConstants
{
public static final VersionConstants INSTANCE = new VersionConstants();
private VersionConstants()
{
}
@Override
public int getMinimumWorldHeight()
{
return 0;
}
@Override
public boolean isWorldGeneratorSingleThreaded(DistanceGenerationMode distanceGenerationMode)
{
switch (distanceGenerationMode)
{
default:
case NONE:
case BIOME_ONLY:
case BIOME_ONLY_SIMULATE_HEIGHT:
case SURFACE:
case FEATURES:
return false;
case FULL:
return true;
}
}
}