aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/makamys/neodymium/mixin/MixinRenderGlobal_OptiFine.java
blob: 8d491d0f6e2604712b4be37d3dd85fae02c4cbc3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package makamys.neodymium.mixin;

import java.nio.IntBuffer;

import org.lwjgl.opengl.GL11;
import org.spongepowered.asm.mixin.Dynamic;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

import makamys.neodymium.Neodymium;
import net.minecraft.client.renderer.RenderGlobal;

/** Blocks vanilla chunk rendering while NeoRenderer is active. (OptiFine compat) */
@Mixin(RenderGlobal.class)
abstract class MixinRenderGlobal_OptiFine {
    
    // for OptiFine's Fast Render option
    @Dynamic
    @Redirect(method = "renderSortedRenderersFast",
              at = @At(value = "INVOKE",
                       target = "Lorg/lwjgl/opengl/GL11;glCallLists(Ljava/nio/IntBuffer;)V"),
              remap=false,
              require = 1)
    private void redirectRenderAllRenderLists(IntBuffer buffer) {
        if(Neodymium.shouldRenderVanillaWorld()) {
            GL11.glCallLists(buffer);
        }
    }
    
}