From 2e947b364c0a608141af611f02ba47ed460f626e Mon Sep 17 00:00:00 2001 From: LexManos <LexManos@gmail.com> Date: Mon, 4 Mar 2013 18:55:15 -0800 Subject: [PATCH] Add helper functions for deling with custom TextureStitched --- .../renderer/texture/TextureMap.java.patch | 42 ++++++++++++++++++- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch index 079730928..baf57e284 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -7,7 +7,7 @@ - String s1 = this.field_94254_c + s + this.field_94251_d; - List list = TextureManager.func_94267_b().func_94266_e(s1); + String s1; -+ if (s.indexOf(':')==-1) ++ if (s.indexOf(':') == -1) + { + s1 = this.field_94254_c + s + this.field_94251_d; + } @@ -15,7 +15,7 @@ + { + String domain = s.substring(0,s.indexOf(':')); + String file = s.substring(s.indexOf(':')+1); -+ s1 = "mods/"+domain +"/" + this.field_94254_c + file + this.field_94251_d; ++ s1 = "mods/" + domain +"/" + field_94254_c + file + field_94251_d; + } + List list = TextureManager.func_94267_b().createNewTexture(s, s1); @@ -40,3 +40,41 @@ ITexturePack itexturepack = Minecraft.getMinecraft().texturePackList.getSelectedTexturePack(); boolean flag1 = !itexturepack.func_98138_b("/" + this.field_94254_c + s2 + ".png", false); +@@ -218,4 +238,37 @@ + { + return this.field_94250_g; + } ++ ++ //=================================================================================================== ++ // Forge Start ++ //=================================================================================================== ++ /** ++ * Grabs the registered entry for the specified name, returning null if there was not a entry. ++ * Opposed to func_94245_a, this will not instantiate the entry, useful to test if a maping exists. ++ * ++ * @param name The name of the entry to find ++ * @return The registered entry, null if nothing was registered. ++ */ ++ public TextureStitched getTextureExtry(String name) ++ { ++ return (TextureStitched)field_94256_j.get(name); ++ } ++ ++ /** ++ * Adds a texture registry entry to this map for the specified name if one does not already exist. ++ * Returns false if the map already contains a entry for the specified name. ++ * ++ * @param name Entry name ++ * @param entry Entry instance ++ * @return True if the entry was added to the map, false otherwise. ++ */ ++ public boolean setTextureEntry(String name, TextureStitched entry) ++ { ++ if (!field_94256_j.containsKey(name)) ++ { ++ field_94256_j.put(name, entry); ++ return true; ++ } ++ return false; ++ } + }