diff options
-rw-r--r-- | src/main/java/makamys/neodymium/Neodymium.java | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/main/java/makamys/neodymium/Neodymium.java b/src/main/java/makamys/neodymium/Neodymium.java index a20dc7c..2b4ab75 100644 --- a/src/main/java/makamys/neodymium/Neodymium.java +++ b/src/main/java/makamys/neodymium/Neodymium.java @@ -2,6 +2,7 @@ package makamys.neodymium; import java.io.File; import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.util.Arrays; import java.util.Objects; import java.util.stream.Collectors; @@ -47,6 +48,7 @@ public class Neodymium public static boolean fogEventWasPosted; public static boolean ofFastRender; + private static Method ofIsFastRenderMethod; @EventHandler public void preInit(FMLPreInitializationEvent event) @@ -112,15 +114,6 @@ public class Neodymium } } } - - if(MixinConfigPlugin.isOptiFinePresent()) { - try { - ofFastRender = (boolean)Class.forName("Config").getMethod("isFastRender").invoke(null); - } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException - | SecurityException | ClassNotFoundException e) { - // oops - } - } } } @@ -136,6 +129,18 @@ public class Neodymium @SubscribeEvent public void onRenderTick(TickEvent.RenderTickEvent event) { if(event.phase == TickEvent.Phase.START) { + if(MixinConfigPlugin.isOptiFinePresent()) { + try { + if(ofIsFastRenderMethod == null) { + ofIsFastRenderMethod = Class.forName("Config").getMethod("isFastRender"); + } + ofFastRender = (boolean)ofIsFastRenderMethod.invoke(null); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException + | SecurityException | ClassNotFoundException e) { + // oops + } + } + EntityPlayer player = Minecraft.getMinecraft().thePlayer; World world = player != null ? player.worldObj : null; if(world != getRendererWorld()) { |