mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 16:27:47 +00:00
Fix domain issue with SoundPool entries.
This commit is contained in:
1 parent
68ba3a84d6
commit
7f5ec0eaef
3 files changed
+43
-23
No files matched your search
@@ -283,4 +283,25 @@ public class ForgeHooksClient
|
||||
stencilBits = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//This properly moves the domain, if provided, to the front of the string before concatenating
|
||||
public static String fixDomain(String base, String complex)
|
||||
{
|
||||
int idx = complex.indexOf(':');
|
||||
if (idx == -1)
|
||||
{
|
||||
return base + complex;
|
||||
}
|
||||
|
||||
String name = complex.substring(idx + 1, complex.length());
|
||||
if (idx > 1)
|
||||
{
|
||||
String domain = complex.substring(0, idx);
|
||||
return domain + ':' + base + name;
|
||||
}
|
||||
else
|
||||
{
|
||||
return base + name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
--- ../src_base/minecraft/net/minecraft/client/audio/SoundPool.java
|
||||
+++ ../src_work/minecraft/net/minecraft/client/audio/SoundPool.java
|
||||
@@ -11,6 +11,7 @@
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import net.minecraft.client.resources.ResourceManager;
|
||||
+import net.minecraftforge.client.ForgeHooksClient;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class SoundPool
|
||||
@@ -71,7 +72,8 @@
|
||||
|
||||
private URL func_110654_c(String par1Str) throws MalformedURLException
|
||||
{
|
||||
- return new URL((URL)null, "minecraft:" + this.field_110656_d + "/" + par1Str, new SoundPoolProtocolHandler(this));
|
||||
+ String path = ForgeHooksClient.fixDomain(field_110656_d + "/", par1Str);
|
||||
+ return new URL((URL)null, "minecraft:" + path, new SoundPoolProtocolHandler(this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -21,7 +21,7 @@
|
||||
String s = (String)entry.getKey();
|
||||
TextureAtlasSprite textureatlassprite = (TextureAtlasSprite)entry.getValue();
|
||||
- ResourceLocation resourcelocation = new ResourceLocation(this.basePath + s + ".png");
|
||||
+ ResourceLocation resourcelocation = new ResourceLocation(fixDomain(basePath, s) + ".png");
|
||||
+ ResourceLocation resourcelocation = new ResourceLocation(ForgeHooksClient.fixDomain(basePath, s) + ".png");
|
||||
|
||||
try
|
||||
{
|
||||
@@ -49,7 +49,7 @@
|
||||
}
|
||||
|
||||
Object object = (TextureAtlasSprite)this.field_110574_e.get(par1Str);
|
||||
@@ -253,4 +260,58 @@
|
||||
@@ -253,4 +260,37 @@
|
||||
{
|
||||
this.updateAnimations();
|
||||
}
|
||||
@@ -85,26 +85,5 @@
|
||||
+ return true;
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ //This properly moves the domain, if provided, to the front of the string before concatenating
|
||||
+ private String fixDomain(String base, String complex)
|
||||
+ {
|
||||
+ int idx = complex.indexOf(':');
|
||||
+ if (idx == -1)
|
||||
+ {
|
||||
+ return base + complex;
|
||||
+ }
|
||||
+
|
||||
+ String name = complex.substring(idx + 1, complex.length());
|
||||
+ if (idx > 1)
|
||||
+ {
|
||||
+ String domain = complex.substring(0, idx);
|
||||
+ return domain + ':' + base + name;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ return base + name;
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
Reference in new issue
Block a user