Move resource location resolution down to TextureAtlasSprite and allow for sprites that are not stitched.

This commit is contained in:
LexManos 2013-07-02 13:57:50 -07:00
parent c0b09854b3
commit ae59f1abb4
2 changed files with 44 additions and 4 deletions

View file

@ -0,0 +1,32 @@
--- ../src_base/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java
+++ ../src_work/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java
@@ -11,6 +11,8 @@
import java.util.List;
import javax.imageio.ImageIO;
import net.minecraft.client.resources.Resource;
+import net.minecraft.client.resources.ResourceLocation;
+import net.minecraft.client.resources.ResourceManager;
import net.minecraft.client.resources.data.AnimationFrame;
import net.minecraft.client.resources.data.AnimationMetadataSection;
import net.minecraft.util.Icon;
@@ -184,6 +186,20 @@
this.height = par1;
}
+ /**
+ * Load the specified resource as this sprite's data.
+ * Returning false from this function will prevent this icon from being stitched onto the master texture.
+ * @param manager Main resource manager
+ * @param location File resource location
+ * @return False to prevent this Icon from being stitched
+ * @throws IOException
+ */
+ public boolean load(ResourceManager manager, ResourceLocation location) throws IOException
+ {
+ func_130100_a(manager.func_110536_a(location));
+ return true;
+ }
+
public void func_130100_a(Resource par1Resource) throws IOException
{
this.func_130102_n();

View file

@ -16,7 +16,7 @@
Iterator iterator = this.field_110574_e.entrySet().iterator();
while (iterator.hasNext())
@@ -69,7 +71,7 @@
@@ -69,11 +71,14 @@
Entry entry = (Entry)iterator.next();
String s = (String)entry.getKey();
TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)entry.getValue();
@ -25,7 +25,15 @@
try
{
@@ -142,6 +144,7 @@
- textureatlassprite.func_130100_a(par1ResourceManager.func_110536_a(resourcelocation));
+ if (!textureatlassprite.load(par1ResourceManager, resourcelocation))
+ {
+ continue;
+ }
}
catch (RuntimeException runtimeexception)
{
@@ -142,6 +147,7 @@
textureatlassprite1 = (TextureAtlasSprite)iterator1.next();
textureatlassprite1.copyFrom(this.missingImage);
}
@ -33,7 +41,7 @@
}
private void func_110573_f()
@@ -212,6 +215,7 @@
@@ -212,6 +218,7 @@
if (par1Str == null)
{
(new RuntimeException("Don\'t register null!")).printStackTrace();
@ -41,7 +49,7 @@
}
Object object = (TextureAtlasSprite)this.field_110574_e.get(par1Str);
@@ -253,4 +257,58 @@
@@ -253,4 +260,58 @@
{
this.updateAnimations();
}