Add Sound loading progress bar (#4593)

This commit is contained in:
gegy1000 2017-12-17 02:39:14 +02:00 committed by LexManos
parent eda4fb231b
commit a38411be70
1 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,40 @@
--- ../src-base/minecraft/net/minecraft/client/audio/SoundHandler.java
+++ ../src-work/minecraft/net/minecraft/client/audio/SoundHandler.java
@@ -67,6 +67,7 @@
{
this.field_147697_e.func_148763_c();
+ java.util.List<net.minecraft.util.Tuple<ResourceLocation, SoundList>> resources = new java.util.LinkedList<>();
for (String s : p_110549_1_.func_135055_a())
{
try
@@ -79,7 +80,7 @@
for (Entry<String, SoundList> entry : map.entrySet())
{
- this.func_147693_a(new ResourceLocation(s, entry.getKey()), entry.getValue());
+ resources.add(new net.minecraft.util.Tuple<>(new ResourceLocation(s, entry.getKey()), entry.getValue()));
}
}
catch (RuntimeException runtimeexception)
@@ -94,6 +95,20 @@
}
}
+ net.minecraftforge.fml.common.ProgressManager.ProgressBar resourcesBar = net.minecraftforge.fml.common.ProgressManager.push("Loading sounds", resources.size());
+ resources.forEach(entry ->
+ {
+ resourcesBar.step(entry.func_76341_a().toString());
+ try
+ {
+ this.func_147693_a(entry.func_76341_a(), entry.func_76340_b());
+ }
+ catch (RuntimeException e)
+ {
+ field_147698_b.warn("Invalid sounds.json", e);
+ }
+ });
+ net.minecraftforge.fml.common.ProgressManager.pop(resourcesBar);
for (ResourceLocation resourcelocation : this.field_147697_e.func_148742_b())
{
SoundEventAccessor soundeventaccessor = (SoundEventAccessor)this.field_147697_e.func_82594_a(resourcelocation);