Add in resource reloading to the bar. Tidy up some of the labels a bit.

This commit is contained in:
cpw 2015-04-24 16:00:22 -04:00
parent 53a21e7e47
commit ab3413a31e
4 changed files with 62 additions and 15 deletions

View file

@ -0,0 +1,46 @@
--- ../src-base/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java
+++ ../src-work/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java
@@ -6,16 +6,22 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
+
+import cpw.mods.fml.common.ProgressManager;
+import cpw.mods.fml.common.ProgressManager.ProgressBar;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
+
import net.minecraft.client.resources.data.IMetadataSerializer;
import net.minecraft.util.ResourceLocation;
+
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -95,6 +101,7 @@
public void func_110541_a(List p_110541_1_)
{
this.func_110543_a();
+ ProgressBar resReload = ProgressManager.push("Resource loading", p_110541_1_.size());
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,10 +119,12 @@
while (iterator.hasNext())
{
IResourcePack iresourcepack = (IResourcePack)iterator.next();
+ resReload.step(iresourcepack.func_130077_b());
this.func_110545_a(iresourcepack);
}
this.func_110544_b();
+ ProgressManager.pop(resReload);
}
public void func_110542_a(IResourceManagerReloadListener p_110542_1_)

View file

@ -183,13 +183,10 @@ public class LoadController
{
modObjectList = buildModObjectList();
}
String event = stateEvent.toString();
event = event.substring(event.lastIndexOf('.') + 1);
event = event.substring(0, event.indexOf('@'));
ProgressBar bar = ProgressManager.push(event + " propagation", activeModList.size());
ProgressBar bar = ProgressManager.push(stateEvent.description(), activeModList.size());
for (ModContainer mc : activeModList)
{
bar.step("mod: "+mc.getName());
bar.step(mc.getName());
sendEventToModContainer(stateEvent, mc);
}
ProgressManager.pop(bar);

View file

@ -464,8 +464,8 @@ public class Loader
*/
public void loadMods()
{
progressBar = ProgressManager.push("FML", 5);
progressBar.step("Constructing");
progressBar = ProgressManager.push("Mod Loading", 5);
progressBar.step("Constructing Mods");
initializeLoader();
mods = Lists.newArrayList();
namedMods = Maps.newHashMap();
@ -505,7 +505,7 @@ public class Loader
{
FMLLog.fine("No user mod signature data found");
}
progressBar.step("Preinitialization");
progressBar.step("Initializing mods Phase 1");
modController.transition(LoaderState.PREINITIALIZATION, false);
}
@ -519,7 +519,7 @@ public class Loader
ObjectHolderRegistry.INSTANCE.findObjectHolders(discoverer.getASMTable());
modController.distributeStateMessage(LoaderState.PREINITIALIZATION, discoverer.getASMTable(), canonicalConfigDir);
ObjectHolderRegistry.INSTANCE.applyObjectHolders();
progressBar.step("Initialization");
progressBar.step("Initializing mods Phase 2");
modController.transition(LoaderState.INITIALIZATION, false);
}
@ -697,7 +697,7 @@ public class Loader
{
// Mod controller should be in the initialization state here
modController.distributeStateMessage(LoaderState.INITIALIZATION);
progressBar.step("Postinitialization");
progressBar.step("Initializing mods Phase 3");
modController.transition(LoaderState.POSTINITIALIZATION, false);
modController.distributeStateMessage(FMLInterModComms.IMCEvent.class);
modController.distributeStateMessage(LoaderState.POSTINITIALIZATION);

View file

@ -5,7 +5,7 @@
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
*
* Contributors:
* cpw - implementation
*/
@ -20,8 +20,12 @@ public class FMLEvent
{
return getClass().getSimpleName();
}
public void applyModContainer(ModContainer activeContainer) {
// NO OP
}
public final String description()
{
String cn = getClass().getName();
return cn.substring(cn.lastIndexOf('.')+4,cn.length()-5);
}
public void applyModContainer(ModContainer activeContainer) {
// NO OP
}
}