Add helper functions for deling with custom TextureStitched

This commit is contained in:
LexManos 2013-03-04 18:55:15 -08:00
parent 88e44f0761
commit 2e947b364c

View file

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