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'.

This commit is contained in:
LexManos 2013-07-02 02:06:12 -07:00
parent b0520f3656
commit e57886e05a
1 changed files with 31 additions and 1 deletions

View File

@ -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;
+ }
+ }
}