From b65b2991a4fd1689cfc675e0831c60c2efb1d907 Mon Sep 17 00:00:00 2001 From: LexManos Date: Tue, 24 May 2016 16:10:47 -0700 Subject: [PATCH] Fix paramters for addArmorMaterial, addOption and addGameType. --- .../client/EnumHelperClient.java | 25 ++++++++++++------- .../common/util/EnumHelper.java | 12 ++++----- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/EnumHelperClient.java b/src/main/java/net/minecraftforge/client/EnumHelperClient.java index 62604d9e7..0f8a48d3e 100644 --- a/src/main/java/net/minecraftforge/client/EnumHelperClient.java +++ b/src/main/java/net/minecraftforge/client/EnumHelperClient.java @@ -2,35 +2,42 @@ package net.minecraftforge.client; import net.minecraft.util.Util.EnumOS; 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; public class EnumHelperClient extends EnumHelper { 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}, {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) { 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) { return addEnum(EnumOS.class, name); } - public static > T addEnum(Class enumType, String enumName, Object... paramValues) + private static > T addEnum(Class enumType, String enumName, Object... paramValues) { return addEnum(clientTypes, enumType, enumName, paramValues); } -} +} \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/common/util/EnumHelper.java b/src/main/java/net/minecraftforge/common/util/EnumHelper.java index 54c001c30..b939a993c 100644 --- a/src/main/java/net/minecraftforge/common/util/EnumHelper.java +++ b/src/main/java/net/minecraftforge/common/util/EnumHelper.java @@ -38,7 +38,7 @@ public class EnumHelper private static Class[][] commonTypes = { {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}, {EnumCreatureAttribute.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); } - 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) { @@ -181,13 +181,13 @@ public class EnumHelper blankField(enumClass, "enumConstants"); } - public static > T addEnum(Class enumType, String enumName, Object... paramValues) + private static > T addEnum(Class enumType, String enumName, Object... paramValues) { setup(); return addEnum(commonTypes, enumType, enumName, paramValues); } - public static > T addEnum(Class[][] map, Class enumType, String enumName, Object... paramValues) + protected static > T addEnum(Class[][] map, Class enumType, String enumName, Object... paramValues) { for (Class[] lookup : map) { @@ -353,4 +353,4 @@ public class EnumHelper setup(); } } -} +} \ No newline at end of file