From 931c99617cf16ac6804aff1833286e9c592c9060 Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Tue, 3 Sep 2019 15:45:25 +0100 Subject: [PATCH] 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... --- src/main/java/electroblob/wizardry/Wizardry.java | 4 ++-- .../electroblob/wizardry/util/CustomSoundCategory.java | 7 +++---- src/main/resources/assets/ebwizardry/lang/en_gb.lang | 2 +- src/main/resources/assets/ebwizardry/lang/en_us.lang | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/java/electroblob/wizardry/Wizardry.java b/src/main/java/electroblob/wizardry/Wizardry.java index e1f4f693..27ff39ea 100644 --- a/src/main/java/electroblob/wizardry/Wizardry.java +++ b/src/main/java/electroblob/wizardry/Wizardry.java @@ -113,6 +113,8 @@ public class Wizardry { proxy.registerRenderers(); proxy.registerKeyBindings(); + WizardrySounds.SPELLS = CustomSoundCategory.add(Wizardry.MODID + "_spells"); + WizardryBaublesIntegration.init(); WizardryAntiqueAtlasIntegration.init(); @@ -151,8 +153,6 @@ public class Wizardry { proxy.initGuiBits(); proxy.registerParticles(); proxy.registerSoundEventListener(); - - WizardrySounds.SPELLS = CustomSoundCategory.add(Wizardry.MODID + ":spells"); } @EventHandler diff --git a/src/main/java/electroblob/wizardry/util/CustomSoundCategory.java b/src/main/java/electroblob/wizardry/util/CustomSoundCategory.java index a0fb1394..8ddb6050 100644 --- a/src/main/java/electroblob/wizardry/util/CustomSoundCategory.java +++ b/src/main/java/electroblob/wizardry/util/CustomSoundCategory.java @@ -59,8 +59,8 @@ public final class CustomSoundCategory { constantName = name.toUpperCase().replace(" ", ""); referenceName = constantName.toLowerCase(); // >> Electroblob: Removed array surrounding varargs argument - soundCategory = EnumHelper.addEnum(SoundCategory.class , constantName, new Class[]{String.class}, referenceName); - SOUND_CATEGORIES = ObfuscationReflectionHelper.getPrivateValue(SoundCategory.class, SoundCategory.VOICE ,"SOUND_CATEGORIES", SRG_SOUND_CATEGORIES); + soundCategory = EnumHelper.addEnum(SoundCategory.class , constantName, new Class[]{String.class}, referenceName); + SOUND_CATEGORIES = ObfuscationReflectionHelper.getPrivateValue(SoundCategory.class, SoundCategory.VOICE, SRG_SOUND_CATEGORIES); if (SOUND_CATEGORIES.containsKey(referenceName)) // >> Electroblob: changed from Error to IllegalArgumentException 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 // >> Electroblob: Fully qualified names, because this class gets loaded on both sides ObfuscationReflectionHelper.setPrivateValue(net.minecraft.client.settings.GameSettings.class, - net.minecraft.client.Minecraft.getMinecraft().gameSettings, soundLevels, - "soundLevels", SRG_soundLevels); + net.minecraft.client.Minecraft.getMinecraft().gameSettings, soundLevels, SRG_soundLevels); } } \ No newline at end of file diff --git a/src/main/resources/assets/ebwizardry/lang/en_gb.lang b/src/main/resources/assets/ebwizardry/lang/en_gb.lang index a4b7cf04..39fa3d51 100644 --- a/src/main/resources/assets/ebwizardry/lang/en_gb.lang +++ b/src/main/resources/assets/ebwizardry/lang/en_gb.lang @@ -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.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 [player | x y z direction] [duration] [modifiers] commands.ebwizardry\:cast.success=Successfully cast %s diff --git a/src/main/resources/assets/ebwizardry/lang/en_us.lang b/src/main/resources/assets/ebwizardry/lang/en_us.lang index d8dad4d1..e276cb39 100644 --- a/src/main/resources/assets/ebwizardry/lang/en_us.lang +++ b/src/main/resources/assets/ebwizardry/lang/en_us.lang @@ -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.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 [player | x y z direction] [duration] [modifiers] commands.ebwizardry\:cast.success=Successfully cast %s