Move sound category initialisation to preInit and replace the colon with an underscore, fixes #198

I should learn to read, it's literally written in the javadoc for CustomSoundCategory...
This commit is contained in:
Electroblob77
2019-09-03 15:45:25 +01:00
parent 037f340a03
commit 931c99617c
4 changed files with 7 additions and 8 deletions
@@ -113,6 +113,8 @@ public class Wizardry {
proxy.registerRenderers(); proxy.registerRenderers();
proxy.registerKeyBindings(); proxy.registerKeyBindings();
WizardrySounds.SPELLS = CustomSoundCategory.add(Wizardry.MODID + "_spells");
WizardryBaublesIntegration.init(); WizardryBaublesIntegration.init();
WizardryAntiqueAtlasIntegration.init(); WizardryAntiqueAtlasIntegration.init();
@@ -151,8 +153,6 @@ public class Wizardry {
proxy.initGuiBits(); proxy.initGuiBits();
proxy.registerParticles(); proxy.registerParticles();
proxy.registerSoundEventListener(); proxy.registerSoundEventListener();
WizardrySounds.SPELLS = CustomSoundCategory.add(Wizardry.MODID + ":spells");
} }
@EventHandler @EventHandler
@@ -59,8 +59,8 @@ public final class CustomSoundCategory {
constantName = name.toUpperCase().replace(" ", ""); constantName = name.toUpperCase().replace(" ", "");
referenceName = constantName.toLowerCase(); referenceName = constantName.toLowerCase();
// >> Electroblob: Removed array surrounding varargs argument // >> Electroblob: Removed array surrounding varargs argument
soundCategory = EnumHelper.addEnum(SoundCategory.class , constantName, new Class[]{String.class}, referenceName); soundCategory = EnumHelper.addEnum(SoundCategory.class , constantName, new Class<?>[]{String.class}, referenceName);
SOUND_CATEGORIES = ObfuscationReflectionHelper.getPrivateValue(SoundCategory.class, SoundCategory.VOICE ,"SOUND_CATEGORIES", SRG_SOUND_CATEGORIES); SOUND_CATEGORIES = ObfuscationReflectionHelper.getPrivateValue(SoundCategory.class, SoundCategory.VOICE, SRG_SOUND_CATEGORIES);
if (SOUND_CATEGORIES.containsKey(referenceName)) if (SOUND_CATEGORIES.containsKey(referenceName))
// >> Electroblob: changed from Error to IllegalArgumentException // >> Electroblob: changed from Error to IllegalArgumentException
throw new IllegalArgumentException("Clash in Sound Category name pools! Cannot insert " + constantName); throw new IllegalArgumentException("Clash in Sound Category name pools! Cannot insert " + constantName);
@@ -79,8 +79,7 @@ public final class CustomSoundCategory {
// Replace the map in the GameSettings.class // Replace the map in the GameSettings.class
// >> Electroblob: Fully qualified names, because this class gets loaded on both sides // >> Electroblob: Fully qualified names, because this class gets loaded on both sides
ObfuscationReflectionHelper.setPrivateValue(net.minecraft.client.settings.GameSettings.class, ObfuscationReflectionHelper.setPrivateValue(net.minecraft.client.settings.GameSettings.class,
net.minecraft.client.Minecraft.getMinecraft().gameSettings, soundLevels, net.minecraft.client.Minecraft.getMinecraft().gameSettings, soundLevels, SRG_soundLevels);
"soundLevels", SRG_soundLevels);
} }
} }
@@ -1021,7 +1021,7 @@ key.ebwizardry.previous_spell=Previous Spell
death.attack.wizardry_magic=%1$s was killed by %2$s using magic death.attack.wizardry_magic=%1$s was killed by %2$s using magic
death.attack.indirect_wizardry_magic=%1$s was killed by %2$s using magic death.attack.indirect_wizardry_magic=%1$s was killed by %2$s using magic
soundCategory.ebwizardry\:spells=Spells soundCategory.ebwizardry_spells=Spells
commands.ebwizardry\:cast.usage=/%1$s <spell> [player | x y z direction] [duration] [modifiers] commands.ebwizardry\:cast.usage=/%1$s <spell> [player | x y z direction] [duration] [modifiers]
commands.ebwizardry\:cast.success=Successfully cast %s commands.ebwizardry\:cast.success=Successfully cast %s
@@ -1021,7 +1021,7 @@ key.ebwizardry.previous_spell=Previous Spell
death.attack.wizardry_magic=%1$s was killed by %2$s using magic death.attack.wizardry_magic=%1$s was killed by %2$s using magic
death.attack.indirect_wizardry_magic=%1$s was killed by %2$s using magic death.attack.indirect_wizardry_magic=%1$s was killed by %2$s using magic
soundCategory.ebwizardry\:spells=Spells soundCategory.ebwizardry_spells=Spells
commands.ebwizardry\:cast.usage=/%1$s <spell> [player | x y z direction] [duration] [modifiers] commands.ebwizardry\:cast.usage=/%1$s <spell> [player | x y z direction] [duration] [modifiers]
commands.ebwizardry\:cast.success=Successfully cast %s commands.ebwizardry\:cast.success=Successfully cast %s