aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/makamys/neodymium/mixin/MixinWorldRenderer.java5
-rw-r--r--src/main/java/makamys/neodymium/renderer/NeoRenderer.java4
2 files changed, 8 insertions, 1 deletions
diff --git a/src/main/java/makamys/neodymium/mixin/MixinWorldRenderer.java b/src/main/java/makamys/neodymium/mixin/MixinWorldRenderer.java
index fb73362..3901a7a 100644
--- a/src/main/java/makamys/neodymium/mixin/MixinWorldRenderer.java
+++ b/src/main/java/makamys/neodymium/mixin/MixinWorldRenderer.java
@@ -49,6 +49,7 @@ abstract class MixinWorldRenderer implements IWorldRenderer {
public boolean needsUpdate;
boolean savedDrawnStatus;
+ private boolean insideUpdateRenderer;
public List<CullableMeshCollection> chunkMeshes;
@@ -71,6 +72,7 @@ abstract class MixinWorldRenderer implements IWorldRenderer {
@Inject(method = "updateRenderer", at = @At(value = "HEAD"))
private void preUpdateRenderer(CallbackInfo ci) {
saveDrawnStatus();
+ insideUpdateRenderer = true;
if(Neodymium.isActive()) {
if(needsUpdate) {
@@ -88,6 +90,7 @@ abstract class MixinWorldRenderer implements IWorldRenderer {
@Inject(method = "updateRenderer", at = @At(value = "RETURN"))
private void postUpdateRenderer(CallbackInfo ci) {
notifyIfDrawnStatusChanged();
+ insideUpdateRenderer = false;
if(Neodymium.isActive()) {
if(chunkMeshes != null) {
@@ -99,7 +102,7 @@ abstract class MixinWorldRenderer implements IWorldRenderer {
@Inject(method = "postRenderBlocks", at = @At(value = "HEAD"))
private void prePostRenderBlocks(int pass, EntityLivingBase entity, CallbackInfo ci) {
- if(Neodymium.isActive() && !Config.disableChunkMeshes) {
+ if(insideUpdateRenderer && Neodymium.isActive() && !Config.disableChunkMeshes) {
if(chunkMeshes != null) {
chunkMeshes.add(ChunkMesh.fromTessellator(pass, WorldRenderer.class.cast(this), Tessellator.instance));
}
diff --git a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
index 7bc582c..d55119f 100644
--- a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
+++ b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
@@ -537,6 +537,10 @@ public class NeoRenderer {
lodChunk.isSectionVisible[y] = change == WorldRendererChange.VISIBLE;
if(change == WorldRendererChange.DELETED) {
removeMesh(lodChunk.chunkMeshes[y]);
+ if(lodChunk.chunkMeshes[y] != null) {
+ lodChunk.chunkMeshes[y].destroy();
+ lodChunk.chunkMeshes[y] = null;
+ }
}
lodChunkChanged(lodChunk);
}