Files
CatServer/patches/net/minecraft/client/audio/SoundHandler.java.patch
2019-02-24 22:29:41 +08:00

53 lines
2.1 KiB
Diff

--- ../src-base/minecraft/net/minecraft/client/audio/SoundHandler.java
+++ ../src-work/minecraft/net/minecraft/client/audio/SoundHandler.java
@@ -67,6 +67,7 @@
{
this.soundRegistry.clearMap();
+ java.util.List<net.minecraft.util.Tuple<ResourceLocation, SoundList>> resources = new java.util.LinkedList<>();
for (String s : resourceManager.getResourceDomains())
{
try
@@ -79,7 +80,7 @@
for (Entry<String, SoundList> entry : map.entrySet())
{
- this.loadSoundResource(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.getFirst().toString());
+ try
+ {
+ this.loadSoundResource(entry.getFirst(), entry.getSecond());
+ }
+ catch (RuntimeException e)
+ {
+ LOGGER.warn("Invalid sounds.json", e);
+ }
+ });
+ net.minecraftforge.fml.common.ProgressManager.pop(resourcesBar);
for (ResourceLocation resourcelocation : this.soundRegistry.getKeys())
{
SoundEventAccessor soundeventaccessor = (SoundEventAccessor)this.soundRegistry.getObject(resourcelocation);
@@ -253,6 +268,11 @@
this.sndManager.setListener(player, p_147691_2_);
}
+ public void setListener(net.minecraft.entity.Entity entity, float partialTicks)
+ {
+ this.sndManager.setListener(entity, partialTicks);
+ }
+
public void pauseSounds()
{
this.sndManager.pauseAllSounds();