diff options
-rw-r--r-- | src/main/java/makamys/neodymium/Neodymium.java | 14 | ||||
-rw-r--r-- | src/main/java/makamys/neodymium/mixin/MixinRenderGlobal.java | 3 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/main/java/makamys/neodymium/Neodymium.java b/src/main/java/makamys/neodymium/Neodymium.java index fc036a5..8602e60 100644 --- a/src/main/java/makamys/neodymium/Neodymium.java +++ b/src/main/java/makamys/neodymium/Neodymium.java @@ -49,6 +49,8 @@ public class Neodymium public static NeoRenderer renderer; + private static World rendererWorld; + @EventHandler public void preInit(FMLConstructionEvent event) { MCLib.init(); @@ -80,8 +82,7 @@ public class Neodymium Config.reloadConfig(); } if(renderer != null) { - renderer.destroy(); - renderer = null; + destroyRenderer(); } if(Config.enabled && newWorld != null) { List<String> warns = new ArrayList<>(); @@ -114,6 +115,7 @@ public class Neodymium renderer.hasIncompatibilities = !warns.isEmpty() || !criticalWarns.isEmpty(); } } + rendererWorld = newWorld; } @SubscribeEvent @@ -131,7 +133,7 @@ public class Neodymium } private World getRendererWorld() { - return renderer != null ? renderer.world : null; + return rendererWorld; } @SubscribeEvent @@ -205,4 +207,10 @@ public class Neodymium } } + public static void destroyRenderer() { + renderer.destroy(); + renderer = null; + rendererWorld = null; + } + } diff --git a/src/main/java/makamys/neodymium/mixin/MixinRenderGlobal.java b/src/main/java/makamys/neodymium/mixin/MixinRenderGlobal.java index 3574868..a059e8e 100644 --- a/src/main/java/makamys/neodymium/mixin/MixinRenderGlobal.java +++ b/src/main/java/makamys/neodymium/mixin/MixinRenderGlobal.java @@ -40,8 +40,7 @@ abstract class MixinRenderGlobal { @Inject(method = "loadRenderers", at = @At(value = "HEAD")) public void preLoadRenderers(CallbackInfo ci) { if(Neodymium.isActive()) { - Neodymium.renderer.destroy(); - Neodymium.renderer = null; + Neodymium.destroyRenderer(); } } |