More progress bar hooks

This commit is contained in:
cpw committed 2015-04-24 17:47:39 -04:00
1 parent d18d493174
commit 3d03b31d00
5 files changed
+60 -6

No files matched your search

@@ -1,6 +1,22 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureMap.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureMap.java
@@ -156,12 +156,14 @@
@@ -96,6 +96,7 @@
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());
Iterator iterator = this.field_110574_e.entrySet().iterator();
TextureAtlasSprite textureatlassprite;
@@ -108,6 +109,7 @@
try
{
+ bar.step(resourcelocation1.func_110623_a());
IResource iresource = p_110571_1_.func_110536_a(resourcelocation1);
BufferedImage[] abufferedimage = new BufferedImage[1 + this.field_147636_j];
abufferedimage[0] = ImageIO.read(iresource.func_110527_b());
@@ -156,12 +158,14 @@
}
catch (RuntimeException runtimeexception)
{
@@ -17,3 +33,11 @@
continue;
}
@@ -169,6 +173,7 @@
stitcher.func_110934_a(textureatlassprite);
}
+ cpw.mods.fml.common.ProgressManager.pop(bar);
int i1 = MathHelper.func_151239_c(j);
if (i1 < this.field_147636_j)
@@ -4,11 +4,11 @@
public void func_110541_a(List p_110541_1_)
{
this.func_110543_a();
+ cpw.mods.fml.common.ProgressManager.ProgressBar resReload = cpw.mods.fml.common.ProgressManager.push("Loading Resources", p_110541_1_.size());
+ cpw.mods.fml.common.ProgressManager.ProgressBar resReload = cpw.mods.fml.common.ProgressManager.push("Loading Resources", p_110541_1_.size()+1);
field_147967_a.info("Reloading ResourceManager: " + field_130074_a.join(Iterables.transform(p_110541_1_, new Function()
{
private static final String __OBFID = "CL_00001092";
@@ -112,16 +113,22 @@
@@ -112,26 +113,35 @@
while (iterator.hasNext())
{
IResourcePack iresourcepack = (IResourcePack)iterator.next();
@@ -16,6 +16,7 @@
this.func_110545_a(iresourcepack);
}
+ resReload.step("Reloading listeners");
this.func_110544_b();
+ cpw.mods.fml.common.ProgressManager.pop(resReload);
}
@@ -24,10 +25,22 @@
{
this.field_110546_b.add(p_110542_1_);
+ cpw.mods.fml.common.ProgressManager.ProgressBar resReload = cpw.mods.fml.common.ProgressManager.push("Loading Resource", 1);
+ String rn = p_110542_1_.getClass().getName();
+ resReload.step(rn.substring(rn.lastIndexOf('.')+1));
+ resReload.step(p_110542_1_.getClass());
p_110542_1_.func_110549_a(this);
+ cpw.mods.fml.common.ProgressManager.pop(resReload);
}
private void func_110544_b()
{
Iterator iterator = this.field_110546_b.iterator();
+ cpw.mods.fml.common.ProgressManager.ProgressBar resReload = cpw.mods.fml.common.ProgressManager.push("Reloading", this.field_110546_b.size());
while (iterator.hasNext())
{
IResourceManagerReloadListener iresourcemanagerreloadlistener = (IResourceManagerReloadListener)iterator.next();
+ resReload.step(iresourcemanagerreloadlistener.getClass());
iresourcemanagerreloadlistener.func_110549_a(this);
}
+ cpw.mods.fml.common.ProgressManager.pop(resReload);
}
}
@@ -0,0 +1,10 @@
package cpw.mods.fml.common;
public class ClassNameUtils
{
public static String shortName(Class<?> clz)
{
String nm = clz.getName();
return nm.indexOf('.') > -1 ? nm.substring(nm.lastIndexOf('.')+1) : nm;
}
}
@@ -709,7 +709,7 @@ public class Loader
// Dump the custom registry data map, if necessary
GameData.dumpRegistry(minecraftDir);
FMLLog.info("Forge Mod Loader has successfully loaded %d mod%s", mods.size(), mods.size() == 1 ? "" : "s");
progressBar.step("Minecraft setup completion");
progressBar.step("Completing Minecraft initialization");
}
public ICrashCallable getCallableCrashInformation()
@@ -4,6 +4,8 @@ import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import com.google.common.base.Joiner;
/**
* @deprecated not a stable API, will break, don't use this yet
*/
@@ -60,6 +62,11 @@ public class ProgressManager
this.steps = steps;
}
public void step(Class<?> classToName, String... extra)
{
step(ClassNameUtils.shortName(classToName)+Joiner.on(' ').join(extra));
}
public void step(String message)
{
if(step >= steps) throw new IllegalStateException("too much steps for ProgressBar " + title);