diff options
Diffstat (limited to 'src/main/java/makamys')
5 files changed, 21 insertions, 13 deletions
diff --git a/src/main/java/makamys/lodmod/LODMod.java b/src/main/java/makamys/lodmod/LODMod.java index 0bf46d7..97ca822 100644 --- a/src/main/java/makamys/lodmod/LODMod.java +++ b/src/main/java/makamys/lodmod/LODMod.java @@ -55,6 +55,9 @@ public class LODMod public static double farPlaneDistanceMultiplier; public static float maxSimpleMeshHeight; public static boolean forceVanillaBiomeTemperature; + public static boolean hideUnderVanillaChunks; + public static boolean disableChunkMeshes; + public static boolean disableSimpleMeshes; private File configFile; @@ -92,6 +95,10 @@ public class LODMod 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, ""); + if(config.hasChanged()) { config.save(); } diff --git a/src/main/java/makamys/lodmod/mixin/MixinWorldRenderer.java b/src/main/java/makamys/lodmod/mixin/MixinWorldRenderer.java index 3515b26..8e36241 100644 --- a/src/main/java/makamys/lodmod/mixin/MixinWorldRenderer.java +++ b/src/main/java/makamys/lodmod/mixin/MixinWorldRenderer.java @@ -95,7 +95,7 @@ abstract class MixinWorldRenderer implements IWorldRenderer { @Inject(method = "postRenderBlocks", at = @At(value = "HEAD")) private void prePostRenderBlocks(int pass, EntityLivingBase entity, CallbackInfo ci) { - if(LODMod.isActive() && !LODMod.renderer.disableChunkMeshes) { + if(LODMod.isActive() && !LODMod.disableChunkMeshes) { if(chunkMeshes != null) { chunkMeshes.add(((ITessellator)Tessellator.instance).toChunkMesh(pass)); } diff --git a/src/main/java/makamys/lodmod/renderer/LODChunk.java b/src/main/java/makamys/lodmod/renderer/LODChunk.java index 7abc662..a0adfe2 100644 --- a/src/main/java/makamys/lodmod/renderer/LODChunk.java +++ b/src/main/java/makamys/lodmod/renderer/LODChunk.java @@ -103,7 +103,7 @@ public class LODChunk { public void tick(Entity player) { double distSq = distSq(player); - if(distSq < Math.pow((LODMod.renderer.renderRange / 2) * 16, 2)) { + if(LODMod.disableSimpleMeshes || distSq < Math.pow((LODMod.renderer.renderRange / 2) * 16, 2)) { setLOD(2); } else if(distSq < Math.pow((LODMod.renderer.renderRange) * 16, 2)) { setLOD(1); diff --git a/src/main/java/makamys/lodmod/renderer/LODRegion.java b/src/main/java/makamys/lodmod/renderer/LODRegion.java index 0ed2324..4004adf 100644 --- a/src/main/java/makamys/lodmod/renderer/LODRegion.java +++ b/src/main/java/makamys/lodmod/renderer/LODRegion.java @@ -58,7 +58,7 @@ public class LODRegion { } public static LODRegion load(Path saveDir, int regionX, int regionZ) { - if(!LODMod.renderer.disableChunkMeshes) { + if(!LODMod.disableChunkMeshes) { File saveFile = getSavePath(saveDir, regionX, regionZ).toFile(); if(saveFile.exists()) { try { @@ -77,7 +77,7 @@ public class LODRegion { } public void save(Path saveDir) { - if(LODMod.renderer.disableChunkMeshes) return; + if(LODMod.disableChunkMeshes) return; try { File saveFile = getSavePath(saveDir, regionX, regionZ).toFile(); diff --git a/src/main/java/makamys/lodmod/renderer/LODRenderer.java b/src/main/java/makamys/lodmod/renderer/LODRenderer.java index 6f4f6af..6ea54c6 100644 --- a/src/main/java/makamys/lodmod/renderer/LODRenderer.java +++ b/src/main/java/makamys/lodmod/renderer/LODRenderer.java @@ -93,7 +93,6 @@ public class LODRenderer { public int renderRange = 48; private boolean freezeMeshes; - public boolean disableChunkMeshes = true; public LODRenderer(World world){ this.world = world; @@ -461,17 +460,19 @@ public class LODRenderer { int z = Math.floorDiv(wr.posZ, 16); LODChunk lodChunk = getLODChunk(x, z); - if(visible) { - lodChunk.hidden[y] = true; - lodChunkChanged(lodChunk); - } else { - lodChunk.hidden[y] = false; - lodChunkChanged(lodChunk); + if(LODMod.hideUnderVanillaChunks) { + if(visible) { + lodChunk.hidden[y] = true; + lodChunkChanged(lodChunk); + } else { + lodChunk.hidden[y] = false; + lodChunkChanged(lodChunk); + } } } public void onWorldRendererPost(WorldRenderer wr) { - if(disableChunkMeshes) return; + if(LODMod.disableChunkMeshes) return; if(Minecraft.getMinecraft().theWorld.getChunkFromChunkCoords(Math.floorDiv(wr.posX, 16), Math.floorDiv(wr.posZ, 16)).isChunkLoaded) { LODChunk lodChunk = getLODChunk(Math.floorDiv(wr.posX, 16), Math.floorDiv(wr.posZ, 16)); @@ -540,7 +541,7 @@ public class LODRenderer { } public void lodChunkChanged(LODChunk lodChunk) { - int newLOD = (!lodChunk.hasChunkMeshes() && lodChunk.lod == 2) ? 1 : lodChunk.lod; + int newLOD = (!lodChunk.hasChunkMeshes() && lodChunk.lod == 2) ? (LODMod.disableSimpleMeshes ? 0 : 1) : lodChunk.lod; for(SimpleChunkMesh sm : lodChunk.simpleMeshes) { if(sm != null) { if(lodChunk.isFullyVisible() && newLOD == 1) { |