aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/makamys/neodymium/mixin
diff options
context:
space:
mode:
authormakamys <makamys@outlook.com>2022-06-30 11:46:32 +0200
committermakamys <makamys@outlook.com>2022-06-30 11:47:20 +0200
commit965636d583a91c3420ec69b81c47b5b961eeb7a7 (patch)
treea0855955428668e32a83d40e419b8d70b249f0d1 /src/main/java/makamys/neodymium/mixin
parent342ab04daf097aded45de402db73783fcc888c80 (diff)
downloadNeodymium-965636d583a91c3420ec69b81c47b5b961eeb7a7.tar.gz
Neodymium-965636d583a91c3420ec69b81c47b5b961eeb7a7.tar.bz2
Neodymium-965636d583a91c3420ec69b81c47b5b961eeb7a7.zip
Fix meshes not disappearing properly when emptied of blocks
Diffstat (limited to 'src/main/java/makamys/neodymium/mixin')
-rw-r--r--src/main/java/makamys/neodymium/mixin/MixinWorldRenderer.java26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/main/java/makamys/neodymium/mixin/MixinWorldRenderer.java b/src/main/java/makamys/neodymium/mixin/MixinWorldRenderer.java
index d744409..32b27a9 100644
--- a/src/main/java/makamys/neodymium/mixin/MixinWorldRenderer.java
+++ b/src/main/java/makamys/neodymium/mixin/MixinWorldRenderer.java
@@ -36,8 +36,18 @@ abstract class MixinWorldRenderer implements IWorldRenderer {
private List<ChunkMesh> nd$chunkMeshes;
- @Inject(method = {"updateRenderer", "updateRendererSort"}, at = @At(value = "HEAD"))
+ @Inject(method = {"updateRenderer"}, at = @At(value = "HEAD"))
private void preUpdateRenderer(CallbackInfo ci) {
+ preUpdateRenderer(false);
+ }
+
+ @Inject(method = {"updateRendererSort"}, at = @At(value = "HEAD"))
+ private void preUpdateRendererSort(CallbackInfo ci) {
+ preUpdateRenderer(true);
+ }
+
+ @Unique
+ private void preUpdateRenderer(boolean sort) {
saveDrawnStatus();
if(Neodymium.isActive()) {
@@ -49,13 +59,23 @@ abstract class MixinWorldRenderer implements IWorldRenderer {
}
}
- @Inject(method = {"updateRenderer", "updateRendererSort"}, at = @At(value = "RETURN"))
+ @Inject(method = {"updateRenderer"}, at = @At(value = "RETURN"))
private void postUpdateRenderer(CallbackInfo ci) {
+ postUpdateRenderer(false);
+ }
+
+ @Inject(method = {"updateRendererSort"}, at = @At(value = "RETURN"))
+ private void postUpdateRendererSort(CallbackInfo ci) {
+ postUpdateRenderer(true);
+ }
+
+ @Unique
+ private void postUpdateRenderer(boolean sort) {
notifyIfDrawnStatusChanged();
if(Neodymium.isActive()) {
if(nd$chunkMeshes != null) {
- Neodymium.renderer.onWorldRendererPost(WorldRenderer.class.cast(this));
+ Neodymium.renderer.onWorldRendererPost(WorldRenderer.class.cast(this), sort);
Collections.fill(nd$chunkMeshes, null);
}
}