Make TextureMap for items and blocks skip the first pass of loading/stitching textures.
Should decrease loading times for large packs. May cause issues with some mods so use -Dfml.skipFirstTextureLoad=false to disable.
This commit is contained in:
parent
6527792d06
commit
4235ca36ea
4 changed files with 62 additions and 28 deletions
|
@ -85,15 +85,17 @@
|
|||
this.func_71361_d("Startup");
|
||||
+ bar.step("Render Global instance");
|
||||
this.field_71438_f = new RenderGlobal(this);
|
||||
- this.field_147128_au = new TextureMap(0, "textures/blocks");
|
||||
+ bar.step("Building Blocks Texture");
|
||||
this.field_147128_au = new TextureMap(0, "textures/blocks");
|
||||
+ this.field_147128_au = new TextureMap(0, "textures/blocks", true);
|
||||
+ bar.step("Anisotropy and Mipmaps");
|
||||
this.field_147128_au.func_147632_b(this.field_71474_y.field_151443_J);
|
||||
this.field_147128_au.func_147633_a(this.field_71474_y.field_151442_I);
|
||||
+ bar.step("Loading Blocks Texture");
|
||||
this.field_71446_o.func_130088_a(TextureMap.field_110575_b, this.field_147128_au);
|
||||
- this.field_71446_o.func_130088_a(TextureMap.field_110576_c, new TextureMap(1, "textures/items"));
|
||||
+ bar.step("Loading Items Texture");
|
||||
this.field_71446_o.func_130088_a(TextureMap.field_110576_c, new TextureMap(1, "textures/items"));
|
||||
+ this.field_71446_o.func_130088_a(TextureMap.field_110576_c, new TextureMap(1, "textures/items", true));
|
||||
+ bar.step("Viewport");
|
||||
GL11.glViewport(0, 0, this.field_71443_c, this.field_71440_d);
|
||||
this.field_71452_i = new EffectRenderer(this.field_71441_e, this.field_71446_o);
|
||||
|
|
|
@ -1,14 +1,44 @@
|
|||
--- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureMap.java
|
||||
+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureMap.java
|
||||
@@ -96,6 +96,7 @@
|
||||
@@ -35,6 +35,7 @@
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class TextureMap extends AbstractTexture implements ITickableTextureObject, IIconRegister
|
||||
{
|
||||
+ 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_110575_b = new ResourceLocation("textures/atlas/blocks.png");
|
||||
public static final ResourceLocation field_110576_c = new ResourceLocation("textures/atlas/items.png");
|
||||
@@ -47,12 +48,18 @@
|
||||
private int field_147637_k = 1;
|
||||
private final TextureAtlasSprite field_94249_f = new TextureAtlasSprite("missingno");
|
||||
private static final String __OBFID = "CL_00001058";
|
||||
+ private boolean skipFirst = false;
|
||||
|
||||
public TextureMap(int p_i1281_1_, String p_i1281_2_)
|
||||
{
|
||||
+ this(p_i1281_1_, p_i1281_2_, false);
|
||||
+ }
|
||||
+ public TextureMap(int p_i1281_1_, String p_i1281_2_, boolean skipFirst)
|
||||
+ {
|
||||
this.field_94255_a = p_i1281_1_;
|
||||
this.field_94254_c = p_i1281_2_;
|
||||
this.func_110573_f();
|
||||
+ this.skipFirst = skipFirst && ENABLE_SKIP;
|
||||
}
|
||||
|
||||
private void func_110569_e()
|
||||
@@ -96,15 +103,17 @@
|
||||
this.field_94252_e.clear();
|
||||
this.field_94258_i.clear();
|
||||
int j = Integer.MAX_VALUE;
|
||||
+ cpw.mods.fml.common.ProgressManager.ProgressBar bar = cpw.mods.fml.common.ProgressManager.push("Texture stitching", this.field_110574_e.size());
|
||||
+ cpw.mods.fml.common.ProgressManager.ProgressBar bar = cpw.mods.fml.common.ProgressManager.push("Texture Loading", skipFirst ? 0 : this.field_110574_e.size());
|
||||
Iterator iterator = this.field_110574_e.entrySet().iterator();
|
||||
TextureAtlasSprite textureatlassprite;
|
||||
|
||||
@@ -105,6 +106,7 @@
|
||||
- while (iterator.hasNext())
|
||||
+ while (!skipFirst && iterator.hasNext())
|
||||
{
|
||||
Entry entry = (Entry)iterator.next();
|
||||
ResourceLocation resourcelocation = new ResourceLocation((String)entry.getKey());
|
||||
textureatlassprite = (TextureAtlasSprite)entry.getValue();
|
||||
ResourceLocation resourcelocation1 = this.func_147634_a(resourcelocation, 0);
|
||||
|
@ -16,7 +46,7 @@
|
|||
|
||||
try
|
||||
{
|
||||
@@ -156,12 +158,14 @@
|
||||
@@ -156,12 +165,14 @@
|
||||
}
|
||||
catch (RuntimeException runtimeexception)
|
||||
{
|
||||
|
@ -33,7 +63,7 @@
|
|||
continue;
|
||||
}
|
||||
|
||||
@@ -169,6 +173,7 @@
|
||||
@@ -169,6 +180,7 @@
|
||||
stitcher.func_110934_a(textureatlassprite);
|
||||
}
|
||||
|
||||
|
@ -41,24 +71,26 @@
|
|||
int i1 = MathHelper.func_151239_c(j);
|
||||
|
||||
if (i1 < this.field_147636_j)
|
||||
@@ -178,10 +183,12 @@
|
||||
@@ -178,10 +190,12 @@
|
||||
}
|
||||
|
||||
Iterator iterator1 = this.field_110574_e.values().iterator();
|
||||
+ bar = cpw.mods.fml.common.ProgressManager.push("Mipmap generation", this.field_110574_e.size());
|
||||
+ bar = cpw.mods.fml.common.ProgressManager.push("Mipmap generation", skipFirst ? 0 : this.field_110574_e.size());
|
||||
|
||||
while (iterator1.hasNext())
|
||||
- while (iterator1.hasNext())
|
||||
+ while (!skipFirst && iterator1.hasNext())
|
||||
{
|
||||
final TextureAtlasSprite textureatlassprite1 = (TextureAtlasSprite)iterator1.next();
|
||||
+ bar.step(textureatlassprite1.func_94215_i());
|
||||
|
||||
try
|
||||
{
|
||||
@@ -222,9 +229,12 @@
|
||||
@@ -222,9 +236,13 @@
|
||||
|
||||
this.field_94249_f.func_147963_d(this.field_147636_j);
|
||||
stitcher.func_110934_a(this.field_94249_f);
|
||||
+ cpw.mods.fml.common.ProgressManager.pop(bar);
|
||||
+ skipFirst = false;
|
||||
+ bar = cpw.mods.fml.common.ProgressManager.push("Texture creation", 3);
|
||||
|
||||
try
|
||||
|
@ -67,7 +99,7 @@
|
|||
stitcher.func_94305_f();
|
||||
}
|
||||
catch (StitcherException stitcherexception)
|
||||
@@ -233,10 +243,12 @@
|
||||
@@ -233,10 +251,12 @@
|
||||
}
|
||||
|
||||
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});
|
||||
|
@ -80,7 +112,7 @@
|
|||
while (iterator2.hasNext())
|
||||
{
|
||||
textureatlassprite = (TextureAtlasSprite)iterator2.next();
|
||||
@@ -274,6 +286,7 @@
|
||||
@@ -274,6 +294,7 @@
|
||||
textureatlassprite = (TextureAtlasSprite)iterator2.next();
|
||||
textureatlassprite.func_94217_a(this.field_94249_f);
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
if (p_147108_1_ instanceof GuiMainMenu)
|
||||
{
|
||||
this.field_71474_y.field_74330_P = false;
|
||||
@@ -1352,7 +1357,7 @@
|
||||
@@ -1353,7 +1358,7 @@
|
||||
|
||||
if (this.field_71439_g.func_82246_f(i, j, k))
|
||||
{
|
||||
|
@ -65,7 +65,7 @@
|
|||
this.field_71439_g.func_71038_i();
|
||||
}
|
||||
}
|
||||
@@ -1433,11 +1438,12 @@
|
||||
@@ -1434,11 +1439,12 @@
|
||||
int j = this.field_71476_x.field_72312_c;
|
||||
int k = this.field_71476_x.field_72309_d;
|
||||
|
||||
|
@ -80,7 +80,7 @@
|
|||
{
|
||||
flag = false;
|
||||
this.field_71439_g.func_71038_i();
|
||||
@@ -1464,7 +1470,8 @@
|
||||
@@ -1465,7 +1471,8 @@
|
||||
{
|
||||
ItemStack itemstack1 = this.field_71439_g.field_71071_by.func_70448_g();
|
||||
|
||||
|
@ -90,7 +90,7 @@
|
|||
{
|
||||
this.field_71460_t.field_78516_c.func_78445_c();
|
||||
}
|
||||
@@ -1676,6 +1683,8 @@
|
||||
@@ -1677,6 +1684,8 @@
|
||||
|
||||
while (Mouse.next())
|
||||
{
|
||||
|
@ -99,7 +99,7 @@
|
|||
j = Mouse.getEventButton();
|
||||
KeyBinding.func_74510_a(j - 100, Mouse.getEventButtonState());
|
||||
|
||||
@@ -2138,6 +2147,11 @@
|
||||
@@ -2139,6 +2148,11 @@
|
||||
|
||||
public void func_71353_a(WorldClient p_71353_1_, String p_71353_2_)
|
||||
{
|
||||
|
@ -111,7 +111,7 @@
|
|||
if (p_71353_1_ == null)
|
||||
{
|
||||
NetHandlerPlayClient nethandlerplayclient = this.func_147114_u();
|
||||
@@ -2150,6 +2164,18 @@
|
||||
@@ -2151,6 +2165,18 @@
|
||||
if (this.field_71437_Z != null)
|
||||
{
|
||||
this.field_71437_Z.func_71263_m();
|
||||
|
@ -130,7 +130,7 @@
|
|||
}
|
||||
|
||||
this.field_71437_Z = null;
|
||||
@@ -2298,113 +2324,10 @@
|
||||
@@ -2299,113 +2325,10 @@
|
||||
if (this.field_71476_x != null)
|
||||
{
|
||||
boolean flag = this.field_71439_g.field_71075_bZ.field_75098_d;
|
||||
|
@ -246,7 +246,7 @@
|
|||
if (flag)
|
||||
{
|
||||
j = this.field_71439_g.field_71069_bz.field_75151_b.size() - 9 + this.field_71439_g.field_71071_by.field_70461_c;
|
||||
@@ -2670,8 +2593,15 @@
|
||||
@@ -2671,8 +2594,15 @@
|
||||
p_70001_1_.func_152767_b("gl_max_texture_size", Integer.valueOf(func_71369_N()));
|
||||
}
|
||||
|
||||
|
@ -262,7 +262,7 @@
|
|||
for (int i = 16384; i > 0; i >>= 1)
|
||||
{
|
||||
GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null);
|
||||
@@ -2679,6 +2609,7 @@
|
||||
@@ -2680,6 +2610,7 @@
|
||||
|
||||
if (j != 0)
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -91,11 +92,14 @@
|
||||
@@ -98,11 +99,14 @@
|
||||
|
||||
public void func_110571_b(IResourceManager p_110571_1_)
|
||||
{
|
||||
|
@ -20,10 +20,10 @@
|
|||
this.field_94258_i.clear();
|
||||
int j = Integer.MAX_VALUE;
|
||||
+ ForgeHooksClient.onTextureStitchedPre(this);
|
||||
cpw.mods.fml.common.ProgressManager.ProgressBar bar = cpw.mods.fml.common.ProgressManager.push("Texture stitching", this.field_110574_e.size());
|
||||
cpw.mods.fml.common.ProgressManager.ProgressBar bar = cpw.mods.fml.common.ProgressManager.push("Texture Loading", skipFirst ? 0 : this.field_110574_e.size());
|
||||
Iterator iterator = this.field_110574_e.entrySet().iterator();
|
||||
TextureAtlasSprite textureatlassprite;
|
||||
@@ -108,6 +112,16 @@
|
||||
@@ -115,6 +119,16 @@
|
||||
ResourceLocation resourcelocation1 = this.func_147634_a(resourcelocation, 0);
|
||||
bar.step(resourcelocation1.func_110623_a());
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
|||
try
|
||||
{
|
||||
IResource iresource = p_110571_1_.func_110536_a(resourcelocation1);
|
||||
@@ -286,6 +300,7 @@
|
||||
@@ -294,6 +308,7 @@
|
||||
textureatlassprite = (TextureAtlasSprite)iterator2.next();
|
||||
textureatlassprite.func_94217_a(this.field_94249_f);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@
|
|||
cpw.mods.fml.common.ProgressManager.pop(bar);
|
||||
}
|
||||
|
||||
@@ -360,7 +375,7 @@
|
||||
@@ -368,7 +383,7 @@
|
||||
{
|
||||
throw new IllegalArgumentException("Name cannot be null!");
|
||||
}
|
||||
|
@ -57,7 +57,7 @@
|
|||
{
|
||||
Object object = (TextureAtlasSprite)this.field_110574_e.get(p_94245_1_);
|
||||
|
||||
@@ -416,4 +431,37 @@
|
||||
@@ -424,4 +439,37 @@
|
||||
{
|
||||
this.field_147637_k = p_147632_1_;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue