diff options
author | makamys <makamys@outlook.com> | 2022-06-03 09:20:46 +0200 |
---|---|---|
committer | makamys <makamys@outlook.com> | 2022-06-03 09:20:46 +0200 |
commit | d337c7abd2e4fd82325c2c0b3eae0f42cef813a6 (patch) | |
tree | d73b7150157d3fb9d654d71291cd8b37d9addd70 /src/main/java/makamys/lodmod | |
parent | a8bcc5b9f10b304e2dafdcd69668ababf0ed5fa8 (diff) | |
download | Neodymium-d337c7abd2e4fd82325c2c0b3eae0f42cef813a6.tar.gz Neodymium-d337c7abd2e4fd82325c2c0b3eae0f42cef813a6.tar.bz2 Neodymium-d337c7abd2e4fd82325c2c0b3eae0f42cef813a6.zip |
Add more options to enable usage as renderer replacer
Diffstat (limited to 'src/main/java/makamys/lodmod')
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) { |