MinecraftForge/MinecraftForge — pull request #1161 by FalconGames (2014-06-19 02:03:00+00:00)
Title: Shader Hook

Hopefully I didn't just fuck up, but you may want to confirm the changes before actually pulling. Here's some example code using the new hook that switches to a custom shader (not writing out an entire new mod for this, just assume this is in some sort of event handler or something):

```java
Minecraft mc = Minecraft.getMinecraft();
ShaderGroup newShaders = new ShaderGroup(mc.getResourceManager(), mc.getFrameBuffer(), new ResourceLocation(StringLibrary.MOD_ID + ":shaders/post/shaderTest.json"));
ShaderGroup tmp;
tmp = EntityRenderer.swapShaderGroup(newShaders);
EntityRenderer.setShaderIndex(0);
EntityRenderer.swapShaders(tmp); //Switch back so that the button never gets access to the current ShaderGroup (meaning no cycling through the new ones).
```

And here is the version for adding new shaders to the ShaderGroup (registered to the "Super Secret Settings" button):

```java
Minecraft mc = Minecraft.getMinecraft();
ShaderGroup newShaders = new ShaderGroup(mc.getResourceManager(), mc.getFrameBuffer(), new ResourceLocation(StringLibrary.MOD_ID + ":shaders/post/shaderTest.json"));
EntityRenderer.appendShaderGroup(newShaders);
//You can go directly to the shaders, or just let them cycle through with the button.
```

I did not know how to go about testing all of these changes (I imagine I'd have to make some custom arguments to `gradlew` for it to use my GitHub repo), so I once again recommend that you try patching my changes before pulling. As far as I can tell, this should all be in order, but there's a chance I made a mistake.