aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/makamys/lodmod/LODMod.java26
-rw-r--r--src/main/java/makamys/lodmod/renderer/LODRenderer.java2
2 files changed, 27 insertions, 1 deletions
diff --git a/src/main/java/makamys/lodmod/LODMod.java b/src/main/java/makamys/lodmod/LODMod.java
index dd25e6b..2c9c160 100644
--- a/src/main/java/makamys/lodmod/LODMod.java
+++ b/src/main/java/makamys/lodmod/LODMod.java
@@ -9,8 +9,11 @@ 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.WorldEvent;
+import java.io.File;
+
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.lwjgl.opengl.GL11;
@@ -19,6 +22,7 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
+import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.relauncher.Side;
@@ -36,6 +40,27 @@ public class LODMod
public static LODRenderer renderer;
+ public static int chunkLoadsPerTick;
+
+ private File configFile;
+
+ @EventHandler
+ public void preInit(FMLPreInitializationEvent event)
+ {
+ configFile = event.getSuggestedConfigurationFile();
+ reloadConfig();
+ }
+
+ private void reloadConfig() {
+ Configuration config = new Configuration(configFile);
+
+ config.load();
+ chunkLoadsPerTick = config.get("Options", "chunkLoadsPerTick", 64).getInt();
+ if(config.hasChanged()) {
+ config.save();
+ }
+ }
+
@EventHandler
public void init(FMLInitializationEvent event)
{
@@ -52,6 +77,7 @@ public class LODMod
LOGGER.warn("Renderer didn't get destroyed last time");
renderer.destroy();
}
+ reloadConfig();
renderer = new LODRenderer();
}
diff --git a/src/main/java/makamys/lodmod/renderer/LODRenderer.java b/src/main/java/makamys/lodmod/renderer/LODRenderer.java
index 3c8303d..4691a2c 100644
--- a/src/main/java/makamys/lodmod/renderer/LODRenderer.java
+++ b/src/main/java/makamys/lodmod/renderer/LODRenderer.java
@@ -478,7 +478,7 @@ public class LODRenderer {
}
public synchronized void serverTick() {
- int chunkLoadsRemaining = 64;
+ int chunkLoadsRemaining = LODMod.chunkLoadsPerTick;
while(!serverChunkLoadQueue.isEmpty() && chunkLoadsRemaining-- > 0) {
ChunkCoordIntPair coords = serverChunkLoadQueue.remove(0);
ChunkProviderServer chunkProviderServer = Minecraft.getMinecraft().getIntegratedServer().worldServers[0].theChunkProviderServer;