195 lines
8.4 KiB
Diff
195 lines
8.4 KiB
Diff
--- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureMap.java
|
|
+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureMap.java
|
|
@@ -27,6 +27,7 @@
|
|
@SideOnly(Side.CLIENT)
|
|
public class TextureMap extends AbstractTexture implements ITickableTextureObject
|
|
{
|
|
+ private static final boolean ENABLE_SKIP = Boolean.parseBoolean(System.getProperty("fml.skipFirstTextureLoad", "true"));
|
|
private static final Logger field_147635_d = LogManager.getLogger();
|
|
public static final ResourceLocation field_174945_f = new ResourceLocation("missingno");
|
|
public static final ResourceLocation field_110575_b = new ResourceLocation("textures/atlas/blocks.png");
|
|
@@ -37,6 +38,7 @@
|
|
private final ITextureMapPopulator field_174946_m;
|
|
private int field_147636_j;
|
|
private final TextureAtlasSprite field_94249_f;
|
|
+ private boolean skipFirst = false;
|
|
|
|
public TextureMap(String p_i46099_1_)
|
|
{
|
|
@@ -45,12 +47,23 @@
|
|
|
|
public TextureMap(String p_i46100_1_, @Nullable ITextureMapPopulator p_i46100_2_)
|
|
{
|
|
+ this(p_i46100_1_, p_i46100_2_, false);
|
|
+ }
|
|
+
|
|
+ public TextureMap(String basePathIn, boolean skipFirst)
|
|
+ {
|
|
+ this(basePathIn, null, skipFirst);
|
|
+ }
|
|
+
|
|
+ public TextureMap(String p_i46100_1_, ITextureMapPopulator p_i46100_2_, boolean skipFirst)
|
|
+ {
|
|
this.field_94258_i = Lists.<TextureAtlasSprite>newArrayList();
|
|
this.field_110574_e = Maps.<String, TextureAtlasSprite>newHashMap();
|
|
this.field_94252_e = Maps.<String, TextureAtlasSprite>newHashMap();
|
|
this.field_94249_f = new TextureAtlasSprite("missingno");
|
|
this.field_94254_c = p_i46100_1_;
|
|
this.field_174946_m = p_i46100_2_;
|
|
+ this.skipFirst = skipFirst && ENABLE_SKIP;
|
|
}
|
|
|
|
private void func_110569_e()
|
|
@@ -89,12 +102,26 @@
|
|
int j = Integer.MAX_VALUE;
|
|
int k = 1 << this.field_147636_j;
|
|
|
|
+ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPre(this);
|
|
+ net.minecraftforge.fml.common.FMLLog.info("Max texture size: %d", i);
|
|
+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", skipFirst ? 0 : this.field_110574_e.size());
|
|
+
|
|
+ if(!skipFirst)
|
|
for (Entry<String, TextureAtlasSprite> entry : this.field_110574_e.entrySet())
|
|
{
|
|
TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)entry.getValue();
|
|
ResourceLocation resourcelocation = this.func_184396_a(textureatlassprite);
|
|
+ bar.step(resourcelocation.func_110623_a());
|
|
IResource iresource = null;
|
|
|
|
+ if (textureatlassprite.hasCustomLoader(p_110571_1_, resourcelocation))
|
|
+ {
|
|
+ if (textureatlassprite.load(p_110571_1_, resourcelocation))
|
|
+ {
|
|
+ continue;
|
|
+ }
|
|
+ }
|
|
+ else
|
|
try
|
|
{
|
|
PngSizeInfo pngsizeinfo = PngSizeInfo.func_188532_a(p_110571_1_.func_110536_a(resourcelocation));
|
|
@@ -104,12 +131,14 @@
|
|
}
|
|
catch (RuntimeException runtimeexception)
|
|
{
|
|
- field_147635_d.error((String)("Unable to parse metadata from " + resourcelocation), (Throwable)runtimeexception);
|
|
+ //logger.error((String)("Unable to parse metadata from " + resourcelocation), (Throwable)runtimeexception);
|
|
+ net.minecraftforge.fml.client.FMLClientHandler.instance().trackBrokenTexture(resourcelocation, runtimeexception.getMessage());
|
|
continue;
|
|
}
|
|
catch (IOException ioexception)
|
|
{
|
|
- field_147635_d.error((String)("Using missing texture, unable to load " + resourcelocation), (Throwable)ioexception);
|
|
+ //logger.error((String)("Using missing texture, unable to load " + resourcelocation), (Throwable)ioexception);
|
|
+ net.minecraftforge.fml.client.FMLClientHandler.instance().trackMissingTexture(resourcelocation);
|
|
continue;
|
|
}
|
|
finally
|
|
@@ -129,6 +158,7 @@
|
|
stitcher.func_110934_a(textureatlassprite);
|
|
}
|
|
|
|
+ net.minecraftforge.fml.common.ProgressManager.pop(bar);
|
|
int l = Math.min(j, k);
|
|
int i1 = MathHelper.func_151239_c(l);
|
|
|
|
@@ -140,9 +170,12 @@
|
|
|
|
this.field_94249_f.func_147963_d(this.field_147636_j);
|
|
stitcher.func_110934_a(this.field_94249_f);
|
|
+ skipFirst = false;
|
|
+ bar = net.minecraftforge.fml.common.ProgressManager.push("Texture creation", 2);
|
|
|
|
try
|
|
{
|
|
+ bar.step("Stitching");
|
|
stitcher.func_94305_f();
|
|
}
|
|
catch (StitcherException stitcherexception)
|
|
@@ -151,11 +184,16 @@
|
|
}
|
|
|
|
field_147635_d.info("Created: {}x{} {}-atlas", new Object[] {Integer.valueOf(stitcher.func_110935_a()), Integer.valueOf(stitcher.func_110936_b()), this.field_94254_c});
|
|
+ bar.step("Allocating GL texture");
|
|
TextureUtil.func_180600_a(this.func_110552_b(), this.field_147636_j, stitcher.func_110935_a(), stitcher.func_110936_b());
|
|
Map<String, TextureAtlasSprite> map = Maps.<String, TextureAtlasSprite>newHashMap(this.field_110574_e);
|
|
|
|
+ net.minecraftforge.fml.common.ProgressManager.pop(bar);
|
|
+ bar = net.minecraftforge.fml.common.ProgressManager.push("Texture mipmap and upload", stitcher.func_94309_g().size());
|
|
+
|
|
for (TextureAtlasSprite textureatlassprite1 : stitcher.func_94309_g())
|
|
{
|
|
+ bar.step(textureatlassprite1.func_94215_i());
|
|
if (textureatlassprite1 == this.field_94249_f || this.func_184397_a(p_110571_1_, textureatlassprite1))
|
|
{
|
|
String s = textureatlassprite1.func_94215_i();
|
|
@@ -186,6 +224,13 @@
|
|
{
|
|
textureatlassprite2.func_94217_a(this.field_94249_f);
|
|
}
|
|
+
|
|
+ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPost(this);
|
|
+
|
|
+ // TextureUtil.saveGlTexture is gone, FIXME
|
|
+ //if (!net.minecraftforge.common.ForgeModContainer.disableStitchedFileSaving)
|
|
+ //TextureUtil.saveGlTexture(this.basePath.replaceAll("/", "_"), this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(), stitcher.getCurrentHeight());
|
|
+ net.minecraftforge.fml.common.ProgressManager.pop(bar);
|
|
}
|
|
|
|
private boolean func_184397_a(IResourceManager p_184397_1_, final TextureAtlasSprite p_184397_2_)
|
|
@@ -195,7 +240,7 @@
|
|
label9:
|
|
{
|
|
boolean flag;
|
|
-
|
|
+ if (p_184397_2_.hasCustomLoader(p_184397_1_, resourcelocation)) break label9;
|
|
try
|
|
{
|
|
iresource = p_184397_1_.func_110536_a(resourcelocation);
|
|
@@ -292,7 +337,7 @@
|
|
}
|
|
else
|
|
{
|
|
- TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.field_110574_e.get(p_174942_1_);
|
|
+ TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)this.field_110574_e.get(p_174942_1_.toString());
|
|
|
|
if (textureatlassprite == null)
|
|
{
|
|
@@ -318,4 +363,37 @@
|
|
{
|
|
return this.field_94249_f;
|
|
}
|
|
+
|
|
+ //===================================================================================================
|
|
+ // 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;
|
|
+ }
|
|
}
|