diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/makamys/lodmod/LODMod.java | 12 | ||||
-rw-r--r-- | src/main/java/makamys/lodmod/mixin/MixinRenderGlobal_OptiFine.java | 3 | ||||
-rw-r--r-- | src/main/java/makamys/lodmod/mixin/MixinTessellator.java | 4 |
3 files changed, 16 insertions, 3 deletions
diff --git a/src/main/java/makamys/lodmod/LODMod.java b/src/main/java/makamys/lodmod/LODMod.java index 5c251e0..acdc45b 100644 --- a/src/main/java/makamys/lodmod/LODMod.java +++ b/src/main/java/makamys/lodmod/LODMod.java @@ -15,6 +15,7 @@ import net.minecraftforge.event.world.ChunkEvent; import net.minecraftforge.event.world.WorldEvent; import java.io.File; +import java.lang.reflect.InvocationTargetException; import java.util.Arrays; import java.util.List; import java.util.Objects; @@ -64,6 +65,8 @@ public class LODMod public static boolean fogEventWasPosted; + public static boolean ofFastRender; + @EventHandler public void preInit(FMLPreInitializationEvent event) { @@ -162,6 +165,15 @@ public class LODMod if(world != getRendererWorld()) { onPlayerWorldChanged(world); } + + if(MixinConfigPlugin.isOptiFinePresent()) { + try { + ofFastRender = (boolean)Class.forName("Config").getMethod("isFastRender").invoke(null); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException + | SecurityException | ClassNotFoundException e) { + // oops + } + } } } diff --git a/src/main/java/makamys/lodmod/mixin/MixinRenderGlobal_OptiFine.java b/src/main/java/makamys/lodmod/mixin/MixinRenderGlobal_OptiFine.java index f1742be..3ce0c4c 100644 --- a/src/main/java/makamys/lodmod/mixin/MixinRenderGlobal_OptiFine.java +++ b/src/main/java/makamys/lodmod/mixin/MixinRenderGlobal_OptiFine.java @@ -9,8 +9,9 @@ import org.spongepowered.asm.mixin.injection.Redirect; import makamys.lodmod.LODMod; import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.RenderGlobal; -@Mixin(RenderBlocks.class) +@Mixin(RenderGlobal.class) abstract class MixinRenderGlobal_OptiFine { // for OptiFine's Fast Render option diff --git a/src/main/java/makamys/lodmod/mixin/MixinTessellator.java b/src/main/java/makamys/lodmod/mixin/MixinTessellator.java index 9bb8e77..08d220a 100644 --- a/src/main/java/makamys/lodmod/mixin/MixinTessellator.java +++ b/src/main/java/makamys/lodmod/mixin/MixinTessellator.java @@ -80,8 +80,8 @@ abstract class MixinTessellator implements ITessellator { int zOffset = wr.posZ; for(int quadI = 0; quadI < this.vertexCount / 4; quadI++) { - boolean of = MixinConfigPlugin.isOptiFinePresent(); - MeshQuad quad = new MeshQuad(rawBuffer, quadI * 32, new ChunkMesh.Flags(hasTexture, hasBrightness, hasColor, hasNormals), of ? xOffset : 0, of ? yOffset : 0, of ? zOffset : 0); + boolean fr = MixinConfigPlugin.isOptiFinePresent() && LODMod.ofFastRender; + MeshQuad quad = new MeshQuad(rawBuffer, quadI * 32, new ChunkMesh.Flags(hasTexture, hasBrightness, hasColor, hasNormals), fr ? xOffset : 0, fr ? yOffset : 0, fr ? zOffset : 0); /*if(quad.bUs[0] == quad.bUs[1] && quad.bUs[1] == quad.bUs[2] && quad.bUs[2] == quad.bUs[3] && quad.bUs[3] == quad.bVs[0] && quad.bVs[0] == quad.bVs[1] && quad.bVs[1] == quad.bVs[2] && quad.bVs[2] == quad.bVs[3] && quad.bVs[3] == 0) { quad.deleted = true; }*/ |