/*
 * This file is part of Dynamic Surroundings, licensed under the MIT License (MIT).
 *
 * Copyright (c) OreCruncher
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

package org.orecruncher.dsurround.mixins;

import java.lang.reflect.Field;
import java.util.Map;

import javax.annotation.Nonnull;

import org.spongepowered.asm.mixin.Mixin;

import net.minecraft.client.settings.GameSettings;
import net.minecraft.util.SoundCategory;
import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.fml.relauncher.ReflectionHelper;

@SuppressWarnings("deprecation")
@Mixin(GameSettings.class)
public abstract class MixinSoundCategory {
	
	static {
		// Hacky way to get this done, but it works.  Longer term need to get rid of this.
		// Not sure of the decent usable way to do this will be.
		if (SoundCategory.getByName("ds_footsteps") == null) {
			// Add our new sound categories
			final SoundCategory fs = EnumHelper.addEnum(SoundCategory.class, "DS_FOOTSTEPS",
					new Class<?>[] { String.class }, "ds_footsteps");
			final SoundCategory b = EnumHelper.addEnum(SoundCategory.class, "DS_BIOME", new Class<?>[] { String.class },
					"ds_biome");

			// Update the internal cached list
			try {
				final Field f = ReflectionHelper.findField(SoundCategory.class, "SOUND_CATEGORIES", "field_187961_k");
				@SuppressWarnings("unchecked")
				final Map<String, SoundCategory> theMap = (Map<String, SoundCategory>) f.get(null);
				theMap.put(fs.getName(), fs);
				theMap.put(b.getName(), b);
			} catch (@Nonnull final Throwable t) {
			}
		}
	}
	
}

@@ -1371,59 +1371,8 @@
 n;%0A%0A
-import net.minecraft.client.settings.GameSettings;%0A
 impo
@@ -1562,20 +1562,21 @@
 xin(
-GameSettings
+SoundCategory
 .cla
@@ -1777,16 +1777,80 @@
 will be.
+  SoundCategory is an enum,%0A%09%09// and we have our own categories.
 %0A%09%09if (S
@@ -1934,16 +1934,77 @@
 egories%0A
+%09%09%09final Class%3C?%3E%5B%5D parms = new Class%3C?%3E%5B%5D %7B String.class %7D;%0A
 %09%09%09final
@@ -2082,45 +2082,14 @@
 PS%22,
-%0A%09%09%09%09%09new Class%3C?%3E%5B%5D %7B String.class %7D
+ parms
 , %22d
@@ -2186,46 +2186,15 @@
 E%22, 
-new Class%3C?%3E%5B%5D %7B String.class %7D,%0A%09%09%09%09%09
+parms, 
 %22ds_

Tweak SoundCategory mixin