aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/makamys/neodymium/Neodymium.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/makamys/neodymium/Neodymium.java')
-rw-r--r--src/main/java/makamys/neodymium/Neodymium.java81
1 files changed, 7 insertions, 74 deletions
diff --git a/src/main/java/makamys/neodymium/Neodymium.java b/src/main/java/makamys/neodymium/Neodymium.java
index 85b34ca..7ed198d 100644
--- a/src/main/java/makamys/neodymium/Neodymium.java
+++ b/src/main/java/makamys/neodymium/Neodymium.java
@@ -3,7 +3,6 @@ package makamys.neodymium;
import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
-import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@@ -32,7 +31,6 @@ import net.minecraftforge.client.event.EntityViewRenderEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
import net.minecraftforge.common.MinecraftForge;
-import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.event.world.ChunkEvent;
import net.minecraftforge.event.world.WorldEvent;
@@ -46,80 +44,15 @@ public class Neodymium
public static NeoRenderer renderer;
- public static boolean enabled;
- public static int chunkLoadsPerTick;
- public static List<Class> blockClassBlacklist;
- public static double fogStart;
- public static double fogEnd;
- public static double farPlaneDistanceMultiplier;
- public static float maxSimpleMeshHeight;
- public static boolean forceVanillaBiomeTemperature;
- public static boolean hideUnderVanillaChunks;
- public static boolean disableChunkMeshes;
- public static boolean disableSimpleMeshes;
- public static boolean saveMeshes;
- public static boolean optimizeChunkMeshes;
- public static int maxMeshesPerFrame;
- public static int sortFrequency;
- public static int gcRate;
- public static int VRAMSize;
- public static int debugPrefix;
- public static int debugInfoStartY;
-
- private File configFile;
-
public static boolean fogEventWasPosted;
public static boolean ofFastRender;
- public static boolean enableFog;
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
- configFile = event.getSuggestedConfigurationFile();
- reloadConfig();
- }
-
- private void reloadConfig() {
- Configuration config = new Configuration(configFile);
-
- config.load();
- enabled = config.get("General", "enabled", true).getBoolean();
- chunkLoadsPerTick = config.get("General", "chunkLoadsPerTick", 64).getInt();
- blockClassBlacklist = Arrays.stream(config.get("General", "blockClassBlacklist", "net.minecraft.block.BlockRotatedPillar;biomesoplenty.common.blocks.BlockBOPLog;gregapi.block.multitileentity.MultiTileEntityBlock").getString().split(";"))
- .map(className -> {
- try {
- return Class.forName(className);
- } catch (ClassNotFoundException e) {
- return null;
- }
- })
- .filter(Objects::nonNull)
- .collect(Collectors.toList());
- fogStart = config.get("Fog", "fogStart", "0.4").getDouble();
- fogEnd = config.get("Fog", "fogEnd", "0.8").getDouble();
- farPlaneDistanceMultiplier = config.get("Fog", "farPlaneDistanceMultiplier", "1.0").getDouble();
-
- maxSimpleMeshHeight = (float)config.get("Debug", "maxSimpleMeshHeight", 1000.0).getDouble();
-
- forceVanillaBiomeTemperature = config.get("Simple mesh generation", "forceVanillaBiomeTemperature", true).getBoolean();
-
- hideUnderVanillaChunks = config.getBoolean("hideUnderVanillaChunks", "render", true, "");
- disableChunkMeshes = config.getBoolean("disableChunkMeshes", "render", true, "");
- disableSimpleMeshes = config.getBoolean("disableSimpleMeshes", "render", false, "");
- optimizeChunkMeshes = config.getBoolean("optimizeChunkMeshes", "render", true, "");
- saveMeshes = config.getBoolean("saveMeshes", "render", false, "");
- maxMeshesPerFrame = config.getInt("maxMeshesPerFrame", "render", -1, -1, Integer.MAX_VALUE, "");
- sortFrequency = config.getInt("sortFrequency", "render", 1, 1, Integer.MAX_VALUE, "");
- gcRate = config.getInt("gcRate", "render", 1, 1, Integer.MAX_VALUE, "Maximum number of meshes to relocate each frame.");
- VRAMSize = config.getInt("VRAMSize", "render", 1024, 1, Integer.MAX_VALUE, "VRAM buffer size (MB).");
- enableFog = config.getBoolean("enableFog", "render", true, "");
- debugPrefix = config.getInt("debugPrefix", "debug", Keyboard.KEY_F4, -1, Integer.MAX_VALUE, "This key has to be held down while pressing the debug keybinds. LWJGL keycode. Setting this to 0 will make the keybinds usable without holding anything else down. Setting this to -1 will disable debug keybinds entirely.");
- debugInfoStartY = config.getInt("debugInfoStartY", "debug", 80, -1, Integer.MAX_VALUE, "The Y position of the first line of the debug info in the F3 overlay. Set this to -1 to disable showing that info.");
-
- if(config.hasChanged()) {
- config.save();
- }
+ Config.configFile = event.getSuggestedConfigurationFile();
+ Config.reloadConfig();
}
@EventHandler
@@ -131,8 +64,8 @@ public class Neodymium
private void onPlayerWorldChanged(World newWorld) {
if(getRendererWorld() == null && newWorld != null) {
- reloadConfig();
- if(enabled) {
+ Config.reloadConfig();
+ if(Config.enabled) {
SpriteUtil.init();
}
}
@@ -140,7 +73,7 @@ public class Neodymium
renderer.destroy();
renderer = null;
}
- if(enabled && newWorld != null) {
+ if(Config.enabled && newWorld != null) {
renderer = new NeoRenderer(newWorld);
}
}
@@ -211,7 +144,7 @@ public class Neodymium
@SubscribeEvent
public void onRenderOverlay(RenderGameOverlayEvent event) {
FontRenderer fontRenderer = RenderManager.instance.getFontRenderer();
- if(isActive() && event.type == ElementType.TEXT && fontRenderer != null && Minecraft.getMinecraft().gameSettings.showDebugInfo && (Neodymium.debugInfoStartY != -1))
+ if(isActive() && event.type == ElementType.TEXT && fontRenderer != null && Minecraft.getMinecraft().gameSettings.showDebugInfo && (Config.debugInfoStartY != -1))
{
Minecraft mc = Minecraft.getMinecraft();
ScaledResolution scaledresolution = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
@@ -220,7 +153,7 @@ public class Neodymium
int yOffset = 0;
for(String s : renderer.getDebugText()) {
- fontRenderer.drawStringWithShadow(s, w - fontRenderer.getStringWidth(s) - 10, Neodymium.debugInfoStartY + yOffset, 0xFFFFFF);
+ fontRenderer.drawStringWithShadow(s, w - fontRenderer.getStringWidth(s) - 10, Config.debugInfoStartY + yOffset, 0xFFFFFF);
yOffset += 10;
}
}