mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-26 15:03:04 +00:00
TextureMap, TextureManager and Stitcher rejects fixed.
This commit is contained in:
1 parent
e80f66778b
commit
3a5b7427a1
5 files changed
+134
-154
No files matched your search
@@ -1,6 +1,24 @@
|
||||
--- ../src-base/minecraft/net/minecraft/client/renderer/texture/Stitcher.java
|
||||
+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/Stitcher.java
|
||||
@@ -74,6 +74,7 @@
|
||||
@@ -59,12 +59,17 @@
|
||||
{
|
||||
Stitcher.Holder[] astitcher$holder = (Stitcher.Holder[])this.setStitchHolders.toArray(new Stitcher.Holder[this.setStitchHolders.size()]);
|
||||
Arrays.sort((Object[])astitcher$holder);
|
||||
+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", astitcher$holder.length);
|
||||
|
||||
for (Stitcher.Holder stitcher$holder : astitcher$holder)
|
||||
{
|
||||
+ bar.step(stitcher$holder.getAtlasSprite().getIconName());
|
||||
if (!this.allocateSlot(stitcher$holder))
|
||||
{
|
||||
String s = String.format("Unable to fit: %s - size: %dx%d - Maybe try a lowerresolution resourcepack?", new Object[] {stitcher$holder.getAtlasSprite().getIconName(), Integer.valueOf(stitcher$holder.getAtlasSprite().getIconWidth()), Integer.valueOf(stitcher$holder.getAtlasSprite().getIconHeight())});
|
||||
+ net.minecraftforge.fml.common.FMLLog.info(s);
|
||||
+ for (Stitcher.Holder h : astitcher$holder)
|
||||
+ net.minecraftforge.fml.common.FMLLog.info(" %s", h);
|
||||
throw new StitcherException(stitcher$holder, s);
|
||||
}
|
||||
}
|
||||
@@ -74,6 +79,7 @@
|
||||
this.currentWidth = MathHelper.roundUpToPowerOfTwo(this.currentWidth);
|
||||
this.currentHeight = MathHelper.roundUpToPowerOfTwo(this.currentHeight);
|
||||
}
|
||||
@@ -8,7 +26,7 @@
|
||||
}
|
||||
|
||||
public List<TextureAtlasSprite> getStichSlots()
|
||||
@@ -262,7 +263,7 @@
|
||||
@@ -262,7 +268,7 @@
|
||||
|
||||
public String toString()
|
||||
{
|
||||
|
||||
+4
-6
@@ -1,17 +1,15 @@
|
||||
++++ REJECTED PATCH 1
|
||||
--- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureManager.java
|
||||
+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureManager.java
|
||||
@@ -139,9 +139,12 @@
|
||||
|
||||
public void onResourceManagerReload(IResourceManager resourceManager)
|
||||
{
|
||||
+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Reloading Texture Manager", this.mapTextureObjects.keySet().size(), true);
|
||||
Iterator iterator = this.mapTextureObjects.entrySet().iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
for (Entry<ResourceLocation, ITextureObject> entry : this.mapTextureObjects.entrySet())
|
||||
{
|
||||
Entry entry = (Entry)iterator.next();
|
||||
+ bar.step(entry.getKey().toString());
|
||||
this.loadTexture((ResourceLocation)entry.getKey(), (ITextureObject)entry.getValue());
|
||||
}
|
||||
+ net.minecraftforge.fml.common.ProgressManager.pop(bar);
|
||||
}
|
||||
}
|
||||
++++ END PATCH
|
||||
@@ -16,7 +16,77 @@
|
||||
|
||||
public TextureMap(String p_i46099_1_)
|
||||
{
|
||||
@@ -167,6 +169,7 @@
|
||||
@@ -47,12 +49,23 @@
|
||||
|
||||
public TextureMap(String p_i46100_1_, IIconCreator iconCreatorIn)
|
||||
{
|
||||
+ this(p_i46100_1_, iconCreatorIn, false);
|
||||
+ }
|
||||
+
|
||||
+ public TextureMap(String p_i46100_1_, boolean skipFirst)
|
||||
+ {
|
||||
+ this(p_i46100_1_, null, skipFirst);
|
||||
+ }
|
||||
+
|
||||
+ public TextureMap(String p_i46100_1_, IIconCreator iconCreatorIn, boolean skipFirst)
|
||||
+ {
|
||||
this.listAnimatedSprites = Lists.<TextureAtlasSprite>newArrayList();
|
||||
this.mapRegisteredSprites = Maps.<String, TextureAtlasSprite>newHashMap();
|
||||
this.mapUploadedSprites = Maps.<String, TextureAtlasSprite>newHashMap();
|
||||
this.missingImage = new TextureAtlasSprite("missingno");
|
||||
this.basePath = p_i46100_1_;
|
||||
this.iconCreator = iconCreatorIn;
|
||||
+ this.skipFirst = skipFirst && ENABLE_SKIP;
|
||||
}
|
||||
|
||||
private void initMissingImage()
|
||||
@@ -91,12 +104,28 @@
|
||||
int j = Integer.MAX_VALUE;
|
||||
int k = 1 << this.mipmapLevels;
|
||||
|
||||
+ 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.mapRegisteredSprites.size());
|
||||
+
|
||||
+ if(!skipFirst)
|
||||
for (Entry<String, TextureAtlasSprite> entry : this.mapRegisteredSprites.entrySet())
|
||||
{
|
||||
TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)entry.getValue();
|
||||
ResourceLocation resourcelocation = new ResourceLocation(textureatlassprite.getIconName());
|
||||
ResourceLocation resourcelocation1 = this.completeResourceLocation(resourcelocation, 0);
|
||||
+ bar.step(resourcelocation1.getResourcePath());
|
||||
|
||||
+ if (textureatlassprite.hasCustomLoader(resourceManager, resourcelocation))
|
||||
+ {
|
||||
+ if (!textureatlassprite.load(resourceManager, resourcelocation))
|
||||
+ {
|
||||
+ j = Math.min(j, Math.min(textureatlassprite.getIconWidth(), textureatlassprite.getIconHeight()));
|
||||
+ stitcher.addSprite(textureatlassprite);
|
||||
+ }
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
try
|
||||
{
|
||||
IResource iresource = resourceManager.getResource(resourcelocation1);
|
||||
@@ -146,12 +175,14 @@
|
||||
}
|
||||
catch (RuntimeException runtimeexception)
|
||||
{
|
||||
- logger.error((String)("Unable to parse metadata from " + resourcelocation1), (Throwable)runtimeexception);
|
||||
+ //logger.error((String)("Unable to parse metadata from " + resourcelocation1), (Throwable)runtimeexception);
|
||||
+ net.minecraftforge.fml.client.FMLClientHandler.instance().trackBrokenTexture(resourcelocation1, runtimeexception.getMessage());
|
||||
continue;
|
||||
}
|
||||
catch (IOException ioexception1)
|
||||
{
|
||||
- logger.error((String)("Using missing texture, unable to load " + resourcelocation1), (Throwable)ioexception1);
|
||||
+ //logger.error((String)("Using missing texture, unable to load " + resourcelocation1), (Throwable)ioexception1);
|
||||
+ net.minecraftforge.fml.client.FMLClientHandler.instance().trackMissingTexture(resourcelocation1);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -167,6 +198,7 @@
|
||||
stitcher.addSprite(textureatlassprite);
|
||||
}
|
||||
|
||||
@@ -24,7 +94,18 @@
|
||||
int j1 = Math.min(j, k);
|
||||
int k1 = MathHelper.calculateLogBaseTwo(j1);
|
||||
|
||||
@@ -217,9 +220,13 @@
|
||||
@@ -176,8 +208,10 @@
|
||||
this.mipmapLevels = k1;
|
||||
}
|
||||
|
||||
+ bar = net.minecraftforge.fml.common.ProgressManager.push("Mipmap generation", skipFirst ? 0 : this.mapRegisteredSprites.size());
|
||||
for (final TextureAtlasSprite textureatlassprite1 : this.mapRegisteredSprites.values())
|
||||
{
|
||||
+ bar.step(textureatlassprite1.getIconName());
|
||||
try
|
||||
{
|
||||
textureatlassprite1.generateMipmaps(this.mipmapLevels);
|
||||
@@ -217,9 +251,13 @@
|
||||
|
||||
this.missingImage.generateMipmaps(this.mipmapLevels);
|
||||
stitcher.addSprite(this.missingImage);
|
||||
@@ -38,7 +119,33 @@
|
||||
stitcher.doStitch();
|
||||
}
|
||||
catch (StitcherException stitcherexception)
|
||||
@@ -323,4 +330,37 @@
|
||||
@@ -228,9 +266,11 @@
|
||||
}
|
||||
|
||||
logger.info("Created: {}x{} {}-atlas", new Object[] {Integer.valueOf(stitcher.getCurrentWidth()), Integer.valueOf(stitcher.getCurrentHeight()), this.basePath});
|
||||
+ bar.step("Allocating GL texture");
|
||||
TextureUtil.allocateTextureImpl(this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(), stitcher.getCurrentHeight());
|
||||
Map<String, TextureAtlasSprite> map = Maps.<String, TextureAtlasSprite>newHashMap(this.mapRegisteredSprites);
|
||||
|
||||
+ bar.step("Uploading GL texture");
|
||||
for (TextureAtlasSprite textureatlassprite2 : stitcher.getStichSlots())
|
||||
{
|
||||
String s = textureatlassprite2.getIconName();
|
||||
@@ -260,6 +300,13 @@
|
||||
{
|
||||
textureatlassprite3.copyFrom(this.missingImage);
|
||||
}
|
||||
+
|
||||
+ 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 ResourceLocation completeResourceLocation(ResourceLocation location, int p_147634_2_)
|
||||
@@ -323,4 +370,37 @@
|
||||
{
|
||||
return this.missingImage;
|
||||
}
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
++++ REJECTED PATCH 1
|
||||
public void doStitch()
|
||||
{
|
||||
Stitcher.Holder[] aholder = (Stitcher.Holder[])this.setStitchHolders.toArray(new Stitcher.Holder[this.setStitchHolders.size()]);
|
||||
+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", aholder.length);
|
||||
Arrays.sort(aholder);
|
||||
Stitcher.Holder[] aholder1 = aholder;
|
||||
int i = aholder.length;
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 2
|
||||
for (int j = 0; j < i; ++j)
|
||||
{
|
||||
Stitcher.Holder holder = aholder1[j];
|
||||
+ bar.step(holder.getAtlasSprite().getIconName());
|
||||
|
||||
if (!this.allocateSlot(holder))
|
||||
{
|
||||
String s = String.format("Unable to fit: %s - size: %dx%d - Maybe try a lowerresolution resourcepack?", new Object[] {holder.getAtlasSprite().getIconName(), Integer.valueOf(holder.getAtlasSprite().getIconWidth()), Integer.valueOf(holder.getAtlasSprite().getIconHeight())});
|
||||
+ net.minecraftforge.fml.common.FMLLog.info(s);
|
||||
+ for (Stitcher.Holder h : aholder)
|
||||
+ net.minecraftforge.fml.common.FMLLog.info(" %s", h);
|
||||
throw new StitcherException(holder, s);
|
||||
}
|
||||
}
|
||||
++++ END PATCH
|
||||
@@ -1,118 +0,0 @@
|
||||
++++ REJECTED PATCH 3
|
||||
|
||||
public TextureMap(String p_i46100_1_, IIconCreator iconCreatorIn)
|
||||
{
|
||||
+ this(p_i46100_1_, iconCreatorIn, false);
|
||||
+ }
|
||||
+
|
||||
+ public TextureMap(String p_i46100_1_, boolean skipFirst)
|
||||
+ {
|
||||
+ this(p_i46100_1_, null, skipFirst);
|
||||
+ }
|
||||
+
|
||||
+ public TextureMap(String p_i46100_1_, IIconCreator iconCreatorIn, boolean skipFirst)
|
||||
+ {
|
||||
this.listAnimatedSprites = Lists.newArrayList();
|
||||
this.mapRegisteredSprites = Maps.newHashMap();
|
||||
this.mapUploadedSprites = Maps.newHashMap();
|
||||
this.missingImage = new TextureAtlasSprite("missingno");
|
||||
this.basePath = p_i46100_1_;
|
||||
this.iconCreator = iconCreatorIn;
|
||||
+ this.skipFirst = skipFirst && ENABLE_SKIP;
|
||||
}
|
||||
|
||||
private void initMissingImage()
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 4
|
||||
this.listAnimatedSprites.clear();
|
||||
int j = Integer.MAX_VALUE;
|
||||
int k = 1 << this.mipmapLevels;
|
||||
+ 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.mapRegisteredSprites.size());
|
||||
Iterator iterator = this.mapRegisteredSprites.entrySet().iterator();
|
||||
|
||||
- while (iterator.hasNext())
|
||||
+ while (!skipFirst && iterator.hasNext())
|
||||
{
|
||||
Entry entry = (Entry)iterator.next();
|
||||
TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)entry.getValue();
|
||||
ResourceLocation resourcelocation = new ResourceLocation(textureatlassprite.getIconName());
|
||||
ResourceLocation resourcelocation1 = this.completeResourceLocation(resourcelocation, 0);
|
||||
+ bar.step(resourcelocation1.getResourcePath());
|
||||
|
||||
+ if (textureatlassprite.hasCustomLoader(resourceManager, resourcelocation))
|
||||
+ {
|
||||
+ if (!textureatlassprite.load(resourceManager, resourcelocation))
|
||||
+ {
|
||||
+ j = Math.min(j, Math.min(textureatlassprite.getIconWidth(), textureatlassprite.getIconHeight()));
|
||||
+ stitcher.addSprite(textureatlassprite);
|
||||
+ }
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
try
|
||||
{
|
||||
IResource iresource = resourceManager.getResource(resourcelocation1);
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 5
|
||||
}
|
||||
catch (RuntimeException runtimeexception)
|
||||
{
|
||||
- logger.error("Unable to parse metadata from " + resourcelocation1, runtimeexception);
|
||||
+ //logger.error("Unable to parse metadata from " + resourcelocation1, runtimeexception);
|
||||
+ net.minecraftforge.fml.client.FMLClientHandler.instance().trackBrokenTexture(resourcelocation1, runtimeexception.getMessage());
|
||||
continue;
|
||||
}
|
||||
catch (IOException ioexception1)
|
||||
{
|
||||
- logger.error("Using missing texture, unable to load " + resourcelocation1, ioexception1);
|
||||
+ //logger.error("Using missing texture, unable to load " + resourcelocation1, ioexception1);
|
||||
+ net.minecraftforge.fml.client.FMLClientHandler.instance().trackMissingTexture(resourcelocation1);
|
||||
continue;
|
||||
}
|
||||
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 7
|
||||
}
|
||||
|
||||
Iterator iterator1 = this.mapRegisteredSprites.values().iterator();
|
||||
+ bar = net.minecraftforge.fml.common.ProgressManager.push("Mipmap generation", skipFirst ? 0 : this.mapRegisteredSprites.size());
|
||||
|
||||
- while (iterator1.hasNext())
|
||||
+ while (!skipFirst && iterator1.hasNext())
|
||||
{
|
||||
final TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)iterator1.next();
|
||||
+ bar.step(textureatlassprite1.getIconName());
|
||||
|
||||
try
|
||||
{
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 9
|
||||
}
|
||||
|
||||
logger.info("Created: {}x{} {}-atlas", new Object[] {Integer.valueOf(stitcher.getCurrentWidth()), Integer.valueOf(stitcher.getCurrentHeight()), this.basePath});
|
||||
+ bar.step("Allocating GL texture");
|
||||
TextureUtil.allocateTextureImpl(this.getGlTextureId(), this.mipmapLevels, stitcher.getCurrentWidth(), stitcher.getCurrentHeight());
|
||||
HashMap hashmap = Maps.newHashMap(this.mapRegisteredSprites);
|
||||
Iterator iterator2 = stitcher.getStichSlots().iterator();
|
||||
TextureAtlasSprite textureatlassprite2;
|
||||
|
||||
+ bar.step("Uploading GL texture");
|
||||
while (iterator2.hasNext())
|
||||
{
|
||||
textureatlassprite2 = (TextureAtlasSprite)iterator2.next();
|
||||
++++ END PATCH
|
||||
++++ REJECTED PATCH 10
|
||||
textureatlassprite2.copyFrom(this.missingImage);
|
||||
}
|
||||
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPost(this);
|
||||
+
|
||||
+ 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 ResourceLocation completeResourceLocation(ResourceLocation location, int p_147634_2_)
|
||||
++++ END PATCH
|
||||
Reference in new issue
Block a user