Fix shader compatibility in default renderer

Disable shaders in cubic and stereoscopic rendering
This commit is contained in:
johni0702
2015-06-04 14:21:44 +02:00
parent a8c5e98c29
commit edd01b3981
6 changed files with 45 additions and 7 deletions

View File

@@ -20,6 +20,7 @@ import net.minecraft.util.ResourceLocation;
import org.lwjgl.util.glu.Project;
import java.awt.image.BufferedImage;
import java.lang.reflect.Field;
import static net.minecraft.client.renderer.GlStateManager.*;
import static org.lwjgl.opengl.GL11.*;
@@ -70,10 +71,20 @@ public abstract class CustomEntityRenderer {
}
}
System.out.println("CustomEntityRenderer using " + renderingStrategy);
// Install entity renderer hooks
try {
Field hookField = EntityRenderer.class.getField("hook");
hookField.set(proxied, this);
} catch (NoSuchFieldException e) {
throw new Error(e);
} catch (IllegalAccessException e) {
throw new Error(e);
}
}
@SuppressWarnings("unused") // Method called by ASM hook
protected void loadShader(ResourceLocation resourceLocation) {
public void loadShader(ResourceLocation resourceLocation) {
if (loadShaderHook != null) {
loadShaderHook.loadShader(resourceLocation);
} else {
@@ -300,6 +311,15 @@ public abstract class CustomEntityRenderer {
}
public void cleanup() {
try {
Field hookField = EntityRenderer.class.getField("hook");
hookField.set(proxied, null);
} catch (NoSuchFieldException e) {
throw new Error(e);
} catch (IllegalAccessException e) {
throw new Error(e);
}
renderingStrategy.cleanup();
spectatorRenderer.cleanup();
}