mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 19:15:32 +00:00
98 lines
3.9 KiB
Diff
98 lines
3.9 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;
|
|
|
|
@@ -91,11 +92,14 @@
|
|
|
|
public void func_110571_b(IResourceManager p_110571_1_)
|
|
{
|
|
+ func_110573_f(); //Re-gather list of Icons, allows for addition/removal of blocks/items after this map was initially constructed.
|
|
+
|
|
int i = Minecraft.func_71369_N();
|
|
Stitcher stitcher = new Stitcher(i, i, true, 0, this.field_147636_j);
|
|
this.field_94252_e.clear();
|
|
this.field_94258_i.clear();
|
|
int j = Integer.MAX_VALUE;
|
|
+ ForgeHooksClient.onTextureStitchedPre(this);
|
|
Iterator iterator = this.field_110574_e.entrySet().iterator();
|
|
TextureAtlasSprite textureatlassprite;
|
|
|
|
@@ -106,6 +110,16 @@
|
|
textureatlassprite = (TextureAtlasSprite)entry.getValue();
|
|
ResourceLocation resourcelocation1 = this.func_147634_a(resourcelocation, 0);
|
|
|
|
+ if (textureatlassprite.hasCustomLoader(p_110571_1_, resourcelocation))
|
|
+ {
|
|
+ if (!textureatlassprite.load(p_110571_1_, resourcelocation))
|
|
+ {
|
|
+ j = Math.min(j, Math.min(textureatlassprite.func_94211_a(), textureatlassprite.func_94216_b()));
|
|
+ stitcher.func_110934_a(textureatlassprite);
|
|
+ }
|
|
+ continue;
|
|
+ }
|
|
+
|
|
try
|
|
{
|
|
IResource iresource = p_110571_1_.func_110536_a(resourcelocation1);
|
|
@@ -274,6 +288,7 @@
|
|
textureatlassprite = (TextureAtlasSprite)iterator2.next();
|
|
textureatlassprite.func_94217_a(this.field_94249_f);
|
|
}
|
|
+ ForgeHooksClient.onTextureStitchedPost(this);
|
|
}
|
|
|
|
private ResourceLocation func_147634_a(ResourceLocation p_147634_1_, int p_147634_2_)
|
|
@@ -347,7 +362,7 @@
|
|
{
|
|
throw new IllegalArgumentException("Name cannot be null!");
|
|
}
|
|
- else if (p_94245_1_.indexOf(47) == -1 && p_94245_1_.indexOf(92) == -1)
|
|
+ else if (p_94245_1_.indexOf(92) == -1) // Disable backslashes (\) in texture asset paths.
|
|
{
|
|
Object object = (TextureAtlasSprite)this.field_110574_e.get(p_94245_1_);
|
|
|
|
@@ -403,4 +418,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)field_110574_e.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 (!field_110574_e.containsKey(name))
|
|
+ {
|
|
+ field_110574_e.put(name, entry);
|
|
+ return true;
|
|
+ }
|
|
+ return false;
|
|
+ }
|
|
}
|