mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-21 12:42:26 +00:00
89 lines
3.6 KiB
Diff
89 lines
3.6 KiB
Diff
--- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureMap.java
|
|
+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureMap.java
|
|
@@ -29,6 +29,7 @@
|
|
import net.minecraft.util.MathHelper;
|
|
import net.minecraft.util.ReportedException;
|
|
import net.minecraft.util.ResourceLocation;
|
|
+import net.minecraftforge.client.ForgeHooksClient;
|
|
import org.apache.logging.log4j.LogManager;
|
|
import org.apache.logging.log4j.Logger;
|
|
|
|
@@ -92,11 +93,14 @@
|
|
|
|
public void loadTextureAtlas(IResourceManager par1ResourceManager)
|
|
{
|
|
+ registerIcons(); //Re-gather list of Icons, allows for addition/removal of blocks/items after this map was initially constructed.
|
|
+
|
|
int i = Minecraft.getGLMaximumTextureSize();
|
|
Stitcher stitcher = new Stitcher(i, i, true, 0, this.field_147636_j);
|
|
this.mapUploadedSprites.clear();
|
|
this.listAnimatedSprites.clear();
|
|
int j = Integer.MAX_VALUE;
|
|
+ ForgeHooksClient.onTextureStitchedPre(this);
|
|
Iterator iterator = this.mapRegisteredSprites.entrySet().iterator();
|
|
TextureAtlasSprite textureatlassprite;
|
|
|
|
@@ -107,6 +111,16 @@
|
|
textureatlassprite = (TextureAtlasSprite)entry.getValue();
|
|
ResourceLocation resourcelocation1 = this.func_147634_a(resourcelocation, 0);
|
|
|
|
+ if (textureatlassprite.hasCustomLoader(par1ResourceManager, resourcelocation))
|
|
+ {
|
|
+ if (!textureatlassprite.load(par1ResourceManager, resourcelocation))
|
|
+ {
|
|
+ j = Math.min(j, Math.min(textureatlassprite.getIconWidth(), textureatlassprite.getIconHeight()));
|
|
+ stitcher.addSprite(textureatlassprite);
|
|
+ }
|
|
+ continue;
|
|
+ }
|
|
+
|
|
try
|
|
{
|
|
IResource iresource = par1ResourceManager.getResource(resourcelocation1);
|
|
@@ -275,6 +289,7 @@
|
|
textureatlassprite = (TextureAtlasSprite)iterator2.next();
|
|
textureatlassprite.copyFrom(this.missingImage);
|
|
}
|
|
+ ForgeHooksClient.onTextureStitchedPost(this);
|
|
}
|
|
|
|
private ResourceLocation func_147634_a(ResourceLocation p_147634_1_, int p_147634_2_)
|
|
@@ -404,4 +419,37 @@
|
|
{
|
|
this.field_147637_k = p_147632_1_;
|
|
}
|
|
+
|
|
+ //===================================================================================================
|
|
+ // Forge Start
|
|
+ //===================================================================================================
|
|
+ /**
|
|
+ * Grabs the registered entry for the specified name, returning null if there was not a entry.
|
|
+ * Opposed to registerIcon, this will not instantiate the entry, useful to test if a mapping exists.
|
|
+ *
|
|
+ * @param name The name of the entry to find
|
|
+ * @return The registered entry, null if nothing was registered.
|
|
+ */
|
|
+ public TextureAtlasSprite getTextureExtry(String name)
|
|
+ {
|
|
+ return (TextureAtlasSprite)mapRegisteredSprites.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, TextureAtlasSprite entry)
|
|
+ {
|
|
+ if (!mapRegisteredSprites.containsKey(name))
|
|
+ {
|
|
+ mapRegisteredSprites.put(name, entry);
|
|
+ return true;
|
|
+ }
|
|
+ return false;
|
|
+ }
|
|
}
|