aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/makamys
diff options
context:
space:
mode:
authormakamys <makamys@outlook.com>2021-05-19 11:39:50 +0200
committermakamys <makamys@outlook.com>2021-05-19 11:39:50 +0200
commit8b13edf3ae85ad5cd2777bdc707502d232bcbc2b (patch)
treea13ea208ac327c0004f4b3e645ea520f04700979 /src/main/java/makamys
parentb22772b8cfc786196579fc7a49b36356f4365ff5 (diff)
downloadNeodymium-8b13edf3ae85ad5cd2777bdc707502d232bcbc2b.tar.gz
Neodymium-8b13edf3ae85ad5cd2777bdc707502d232bcbc2b.tar.bz2
Neodymium-8b13edf3ae85ad5cd2777bdc707502d232bcbc2b.zip
Disable chunk meshes because they're so memory leaky
Diffstat (limited to 'src/main/java/makamys')
-rw-r--r--src/main/java/makamys/lodmod/mixin/MixinWorldRenderer.java2
-rw-r--r--src/main/java/makamys/lodmod/renderer/LODRegion.java20
-rw-r--r--src/main/java/makamys/lodmod/renderer/LODRenderer.java3
3 files changed, 16 insertions, 9 deletions
diff --git a/src/main/java/makamys/lodmod/mixin/MixinWorldRenderer.java b/src/main/java/makamys/lodmod/mixin/MixinWorldRenderer.java
index 3dc2187..112c97c 100644
--- a/src/main/java/makamys/lodmod/mixin/MixinWorldRenderer.java
+++ b/src/main/java/makamys/lodmod/mixin/MixinWorldRenderer.java
@@ -91,7 +91,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()) {
+ if(LODMod.isActive() && !LODMod.renderer.disableChunkMeshes) {
chunkMeshes.add(((ITessellator)Tessellator.instance).toChunkMesh(pass));
}
}
diff --git a/src/main/java/makamys/lodmod/renderer/LODRegion.java b/src/main/java/makamys/lodmod/renderer/LODRegion.java
index 404ec81..0ed2324 100644
--- a/src/main/java/makamys/lodmod/renderer/LODRegion.java
+++ b/src/main/java/makamys/lodmod/renderer/LODRegion.java
@@ -58,14 +58,16 @@ public class LODRegion {
}
public static LODRegion load(Path saveDir, int regionX, int regionZ) {
- File saveFile = getSavePath(saveDir, regionX, regionZ).toFile();
- if(saveFile.exists()) {
- try {
- NBTTagCompound nbt = CompressedStreamTools.readCompressed(new FileInputStream(saveFile));
- return new LODRegion(regionX, regionZ, nbt);
- } catch (Exception e) {
- e.printStackTrace();
- }
+ if(!LODMod.renderer.disableChunkMeshes) {
+ File saveFile = getSavePath(saveDir, regionX, regionZ).toFile();
+ if(saveFile.exists()) {
+ try {
+ NBTTagCompound nbt = CompressedStreamTools.readCompressed(new FileInputStream(saveFile));
+ return new LODRegion(regionX, regionZ, nbt);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
}
return new LODRegion(regionX, regionZ);
}
@@ -75,6 +77,8 @@ public class LODRegion {
}
public void save(Path saveDir) {
+ if(LODMod.renderer.disableChunkMeshes) return;
+
try {
File saveFile = getSavePath(saveDir, regionX, regionZ).toFile();
saveFile.getParentFile().mkdirs();
diff --git a/src/main/java/makamys/lodmod/renderer/LODRenderer.java b/src/main/java/makamys/lodmod/renderer/LODRenderer.java
index 22a812e..3c8303d 100644
--- a/src/main/java/makamys/lodmod/renderer/LODRenderer.java
+++ b/src/main/java/makamys/lodmod/renderer/LODRenderer.java
@@ -88,6 +88,7 @@ public class LODRenderer {
public int renderRange = 48;
private boolean freezeMeshes;
+ public boolean disableChunkMeshes = true;
public LODRenderer(){
hasInited = init();
@@ -447,6 +448,8 @@ public class LODRenderer {
}
public void onWorldRendererPost(WorldRenderer wr) {
+ if(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));
lodChunk.putChunkMeshes(Math.floorDiv(wr.posY, 16), ((IWorldRenderer)wr).getChunkMeshes());