Fix paramters for addArmorMaterial, addOption and addGameType.

This commit is contained in:
LexManos 2016-05-24 16:10:47 -07:00
parent d2989c83a7
commit b65b2991a4
2 changed files with 22 additions and 15 deletions

View file

@ -2,35 +2,42 @@ package net.minecraftforge.client;
import net.minecraft.util.Util.EnumOS; import net.minecraft.util.Util.EnumOS;
import net.minecraft.world.WorldSettings.GameType; import net.minecraft.world.WorldSettings.GameType;
import net.minecraft.client.settings.GameSettings.Options; import net.minecraft.client.settings.GameSettings.Options;
import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.common.util.EnumHelper;
public class EnumHelperClient extends EnumHelper public class EnumHelperClient extends EnumHelper
{ {
private static Class<?>[][] clientTypes = private static Class<?>[][] clientTypes =
{ {
{GameType.class, int.class, String.class}, {GameType.class, int.class, String.class, String.class},
{Options.class, String.class, boolean.class, boolean.class}, {Options.class, String.class, boolean.class, boolean.class},
{EnumOS.class} {EnumOS.class}
}; };
public static GameType addGameType(String name, int id, String displayName) public static GameType addGameType(String name, int id, String displayName, String shortName)
{ {
return addEnum(GameType.class, name, id, displayName); return addEnum(GameType.class, name, id, displayName, shortName);
} }
public static Options addOptions(String name, String langName, boolean isSlider, boolean isToggle) public static Options addOptions(String name, String langName, boolean isSlider, boolean isToggle)
{ {
return addEnum(Options.class, name, langName, isSlider, isToggle); return addEnum(Options.class, name, langName, isSlider, isToggle);
} }
public static Options addOptions(String name, String langName, boolean isSlider, boolean isToggle, float valMin, float valMax, float valStep)
{
return addEnum(Options.class, name,
new Class<?>[]{String.class, boolean.class, boolean.class, float.class, float.class, float.class},
langName, isSlider, isToggle, valMin, valMax, valStep);
}
public static EnumOS addOS2(String name) public static EnumOS addOS2(String name)
{ {
return addEnum(EnumOS.class, name); return addEnum(EnumOS.class, name);
} }
public static <T extends Enum<? >> T addEnum(Class<T> enumType, String enumName, Object... paramValues) private static <T extends Enum<? >> T addEnum(Class<T> enumType, String enumName, Object... paramValues)
{ {
return addEnum(clientTypes, enumType, enumName, paramValues); return addEnum(clientTypes, enumType, enumName, paramValues);
} }
} }

View file

@ -38,7 +38,7 @@ public class EnumHelper
private static Class<?>[][] commonTypes = private static Class<?>[][] commonTypes =
{ {
{EnumAction.class}, {EnumAction.class},
{ArmorMaterial.class, String.class, int.class, int[].class, int.class, SoundEvent.class}, {ArmorMaterial.class, String.class, int.class, int[].class, int.class, SoundEvent.class, float.class},
{EnumArt.class, String.class, int.class, int.class, int.class, int.class}, {EnumArt.class, String.class, int.class, int.class, int.class, int.class},
{EnumCreatureAttribute.class}, {EnumCreatureAttribute.class},
{EnumCreatureType.class, Class.class, int.class, Material.class, boolean.class, boolean.class}, {EnumCreatureType.class, Class.class, int.class, Material.class, boolean.class, boolean.class},
@ -56,9 +56,9 @@ public class EnumHelper
{ {
return addEnum(EnumAction.class, name); return addEnum(EnumAction.class, name);
} }
public static ArmorMaterial addArmorMaterial(String name, String textureName, int durability, int[] reductionAmounts, int enchantability, SoundEvent soundOnEquip) public static ArmorMaterial addArmorMaterial(String name, String textureName, int durability, int[] reductionAmounts, int enchantability, SoundEvent soundOnEquip, float toughness)
{ {
return addEnum(ArmorMaterial.class, name, textureName, durability, reductionAmounts, enchantability, soundOnEquip); return addEnum(ArmorMaterial.class, name, textureName, durability, reductionAmounts, enchantability, soundOnEquip, toughness);
} }
public static EnumArt addArt(String name, String tile, int sizeX, int sizeY, int offsetX, int offsetY) public static EnumArt addArt(String name, String tile, int sizeX, int sizeY, int offsetX, int offsetY)
{ {
@ -181,13 +181,13 @@ public class EnumHelper
blankField(enumClass, "enumConstants"); blankField(enumClass, "enumConstants");
} }
public static <T extends Enum<? >> T addEnum(Class<T> enumType, String enumName, Object... paramValues) private static <T extends Enum<? >> T addEnum(Class<T> enumType, String enumName, Object... paramValues)
{ {
setup(); setup();
return addEnum(commonTypes, enumType, enumName, paramValues); return addEnum(commonTypes, enumType, enumName, paramValues);
} }
public static <T extends Enum<? >> T addEnum(Class<?>[][] map, Class<T> enumType, String enumName, Object... paramValues) protected static <T extends Enum<? >> T addEnum(Class<?>[][] map, Class<T> enumType, String enumName, Object... paramValues)
{ {
for (Class<?>[] lookup : map) for (Class<?>[] lookup : map)
{ {
@ -353,4 +353,4 @@ public class EnumHelper
setup(); setup();
} }
} }
} }