From e57886e05a760989b28676cf1beee7705120a358 Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 2 Jul 2013 02:06:12 -0700 Subject: [PATCH] Fix resource domain when loading icon. Textures should be located in /assets/{domain}/textures/{block|item}/{name}.png Same strcutre as before except 'assets' instead of 'mods'. --- .../renderer/texture/TextureMap.java.patch | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) 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 713b936be..9db4e417b 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -16,6 +16,15 @@ Iterator iterator = this.field_110574_e.entrySet().iterator(); while (iterator.hasNext()) +@@ -69,7 +71,7 @@ + Entry entry = (Entry)iterator.next(); + String s = (String)entry.getKey(); + TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)entry.getValue(); +- ResourceLocation resourcelocation = new ResourceLocation(this.basePath + s + ".png"); ++ ResourceLocation resourcelocation = new ResourceLocation(fixDomain(basePath, s) + ".png"); + + try + { @@ -142,6 +144,7 @@ textureatlassprite1 = (TextureAtlasSprite)iterator1.next(); textureatlassprite1.copyFrom(this.missingImage); @@ -32,7 +41,7 @@ } Object object = (TextureAtlasSprite)this.field_110574_e.get(par1Str); -@@ -253,4 +257,37 @@ +@@ -253,4 +257,58 @@ { this.updateAnimations(); } @@ -68,5 +77,26 @@ + return true; + } + return false; ++ } ++ ++ //This properly moves the domain, if provided, to the front of the string before concatenating ++ private String fixDomain(String base, String complex) ++ { ++ int idx = complex.indexOf(':'); ++ if (idx == -1) ++ { ++ return base + complex; ++ } ++ ++ String name = complex.substring(idx + 1, complex.length()); ++ if (idx > 1) ++ { ++ String domain = complex.substring(0, idx); ++ return domain + ':' + base + name; ++ } ++ else ++ { ++ return base + name; ++ } + } }