Added ChickenBones's request ITextureLoadHandler hook

This commit is contained in:
LexManos 2012-04-06 23:01:19 -07:00
parent 4e575f353f
commit 421f31cce5
4 changed files with 53 additions and 2 deletions

View file

@ -44,6 +44,15 @@ public class ForgeHooksClient
public static LinkedList<IHighlightHandler> highlightHandlers = new LinkedList<IHighlightHandler>();
public static LinkedList<IRenderWorldLastHandler> renderWorldLastHandlers = new LinkedList<IRenderWorldLastHandler>();
public static void onTextureLoad(String textureName, int textureID)
{
for (ITextureLoadHandler handler: textureLoadHandlers)
{
handler.onTextureLoad(textureName, textureID);
}
}
public static LinkedList<ITextureLoadHandler> textureLoadHandlers = new LinkedList<ITextureLoadHandler>();
public static boolean canRenderInPass(Block block, int pass)
{

View file

@ -0,0 +1,6 @@
package net.minecraft.src.forge;
public interface ITextureLoadHandler
{
public void onTextureLoad(String textureName, int textureID);
}

View file

@ -36,6 +36,24 @@ public class MinecraftForgeClient
{
ForgeHooksClient.registerRenderContextHandler(texture, subid, handler);
}
/**
* Registers a Texture Load Handler
* @param handler The handler
*/
public static void registerTextureLoadHandler(ITextureLoadHandler handler)
{
ForgeHooksClient.textureLoadHandlers.add(handler);
}
/**
* Registers a Render Last Handler
* @param handler The handler
*/
public static void registerRenderLastHandler(IRenderWorldLastHandler handler)
{
ForgeHooksClient.renderWorldLastHandlers.add(handler);
}
/** Bind a texture. This is used to bind a texture file when
* performing your own rendering, rather than using ITextureProvider.

View file

@ -1,6 +1,16 @@
--- ../src_base/minecraft/net/minecraft/src/RenderEngine.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/RenderEngine.java 0000-00-00 00:00:00.000000000 -0000
@@ -48,7 +48,7 @@
@@ -14,6 +14,9 @@
import java.util.List;
import java.util.Map;
import javax.imageio.ImageIO;
+
+import net.minecraft.src.forge.ForgeHooksClient;
+
import org.lwjgl.opengl.GL11;
public class RenderEngine
@@ -48,7 +51,7 @@
public boolean blurTexture = false;
/** Texture pack */
@ -9,7 +19,7 @@
/** Missing texture image */
private BufferedImage missingTextureImage = new BufferedImage(64, 64, 2);
@@ -156,6 +156,10 @@
@@ -156,6 +159,10 @@
{
try
{
@ -20,3 +30,11 @@
this.singleIntBuffer.clear();
GLAllocation.generateTextureNames(this.singleIntBuffer);
int var6 = this.singleIntBuffer.get(0);
@@ -199,6 +206,7 @@
}
this.textureMap.put(par1Str, Integer.valueOf(var6));
+ ForgeHooksClient.onTextureLoad(par1Str, var6);
return var6;
}
catch (Exception var5)