diff --git a/forge/forge_client/src/net/minecraft/src/forge/ForgeHooksClient.java b/forge/forge_client/src/net/minecraft/src/forge/ForgeHooksClient.java index 55bdb3805..1def88887 100644 --- a/forge/forge_client/src/net/minecraft/src/forge/ForgeHooksClient.java +++ b/forge/forge_client/src/net/minecraft/src/forge/ForgeHooksClient.java @@ -44,6 +44,15 @@ public class ForgeHooksClient public static LinkedList highlightHandlers = new LinkedList(); public static LinkedList renderWorldLastHandlers = new LinkedList(); + + public static void onTextureLoad(String textureName, int textureID) + { + for (ITextureLoadHandler handler: textureLoadHandlers) + { + handler.onTextureLoad(textureName, textureID); + } + } + public static LinkedList textureLoadHandlers = new LinkedList(); public static boolean canRenderInPass(Block block, int pass) { diff --git a/forge/forge_client/src/net/minecraft/src/forge/ITextureLoadHandler.java b/forge/forge_client/src/net/minecraft/src/forge/ITextureLoadHandler.java new file mode 100644 index 000000000..b83ee4cf1 --- /dev/null +++ b/forge/forge_client/src/net/minecraft/src/forge/ITextureLoadHandler.java @@ -0,0 +1,6 @@ +package net.minecraft.src.forge; + +public interface ITextureLoadHandler +{ + public void onTextureLoad(String textureName, int textureID); +} diff --git a/forge/forge_client/src/net/minecraft/src/forge/MinecraftForgeClient.java b/forge/forge_client/src/net/minecraft/src/forge/MinecraftForgeClient.java index bb1f68b3d..fc938e4bc 100755 --- a/forge/forge_client/src/net/minecraft/src/forge/MinecraftForgeClient.java +++ b/forge/forge_client/src/net/minecraft/src/forge/MinecraftForgeClient.java @@ -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. diff --git a/forge/patches/minecraft/net/minecraft/src/RenderEngine.java.patch b/forge/patches/minecraft/net/minecraft/src/RenderEngine.java.patch index f212f6964..06fbdf546 100644 --- a/forge/patches/minecraft/net/minecraft/src/RenderEngine.java.patch +++ b/forge/patches/minecraft/net/minecraft/src/RenderEngine.java.patch @@ -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)