From a38411be708f3458c72deca0d856ded23547ca0e Mon Sep 17 00:00:00 2001 From: gegy1000 Date: Sun, 17 Dec 2017 02:39:14 +0200 Subject: [PATCH] Add Sound loading progress bar (#4593) --- .../client/audio/SoundHandler.java.patch | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 patches/minecraft/net/minecraft/client/audio/SoundHandler.java.patch diff --git a/patches/minecraft/net/minecraft/client/audio/SoundHandler.java.patch b/patches/minecraft/net/minecraft/client/audio/SoundHandler.java.patch new file mode 100644 index 000000000..c89ee3541 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/audio/SoundHandler.java.patch @@ -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> resources = new java.util.LinkedList<>(); + for (String s : p_110549_1_.func_135055_a()) + { + try +@@ -79,7 +80,7 @@ + + for (Entry 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);