public class EnumHelper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static java.lang.Class<?>[][] |
commonTypes |
private static java.lang.reflect.Method |
fieldAccessorSet |
private static boolean |
isSetup |
private static java.lang.reflect.Method |
newConstructorAccessor |
private static java.lang.reflect.Method |
newFieldAccessor |
private static java.lang.reflect.Method |
newInstance |
private static java.lang.Object |
reflectionFactory |
Constructor and Description |
---|
EnumHelper() |
Modifier and Type | Method and Description |
---|---|
static EnumAction |
addAction(java.lang.String name) |
static ItemArmor.ArmorMaterial |
addArmorMaterial(java.lang.String name,
java.lang.String textureName,
int durability,
int[] reductionAmounts,
int enchantability,
SoundEvent soundOnEquip,
float toughness) |
static EntityPainting.EnumArt |
addArt(java.lang.String name,
java.lang.String tile,
int sizeX,
int sizeY,
int offsetX,
int offsetY) |
static EnumCreatureAttribute |
addCreatureAttribute(java.lang.String name) |
static EnumCreatureType |
addCreatureType(java.lang.String name,
java.lang.Class<? extends IAnimals> typeClass,
int maxNumber,
Material material,
boolean peaceful,
boolean animal) |
static StructureStrongholdPieces.Stronghold.Door |
addDoor(java.lang.String name) |
static EnumEnchantmentType |
addEnchantmentType(java.lang.String name,
com.google.common.base.Predicate<Item> delegate) |
private static <T extends java.lang.Enum<?>> |
addEnum(boolean test,
java.lang.Class<T> enumType,
java.lang.String enumName,
java.lang.Class<?>[] paramTypes,
java.lang.Object[] paramValues) |
protected static <T extends java.lang.Enum<?>> |
addEnum(java.lang.Class<?>[][] map,
java.lang.Class<T> enumType,
java.lang.String enumName,
java.lang.Object... paramValues) |
static <T extends java.lang.Enum<?>> |
addEnum(java.lang.Class<T> enumType,
java.lang.String enumName,
java.lang.Class<?>[] paramTypes,
java.lang.Object... paramValues) |
private static <T extends java.lang.Enum<?>> |
addEnum(java.lang.Class<T> enumType,
java.lang.String enumName,
java.lang.Object... paramValues) |
static HorseArmorType |
addHorseArmor(java.lang.String name,
java.lang.String textureLocation,
int armorStrength) |
static RayTraceResult.Type |
addMovingObjectType(java.lang.String name) |
static EnumRarity |
addRarity(java.lang.String name,
TextFormatting color,
java.lang.String displayName)
Deprecated.
use
IRarity instead |
static BlockPressurePlate.Sensitivity |
addSensitivity(java.lang.String name) |
static EnumSkyBlock |
addSkyBlock(java.lang.String name,
int lightValue) |
static EntityLiving.SpawnPlacementType |
addSpawnPlacementType(java.lang.String name,
java.util.function.BiPredicate<IBlockAccess,BlockPos> predicate) |
static EntityPlayer.SleepResult |
addStatus(java.lang.String name) |
static Item.ToolMaterial |
addToolMaterial(java.lang.String name,
int harvestLevel,
int maxUses,
float efficiency,
float damage,
int enchantability) |
private static void |
blankField(java.lang.Class<?> enumClass,
java.lang.String fieldName) |
private static void |
cleanEnumCache(java.lang.Class<?> enumClass) |
private static java.lang.Object |
getConstructorAccessor(java.lang.Class<?> enumClass,
java.lang.Class<?>[] additionalParameterTypes) |
private static <T extends java.lang.Enum<?>> |
makeEnum(java.lang.Class<T> enumClass,
java.lang.String value,
int ordinal,
java.lang.Class<?>[] additionalTypes,
java.lang.Object[] additionalValues) |
static void |
setFailsafeFieldValue(java.lang.reflect.Field field,
java.lang.Object target,
java.lang.Object value) |
private static void |
setup() |
static void |
testEnum(java.lang.Class<? extends java.lang.Enum<?>> enumType,
java.lang.Class<?>[] paramTypes) |
private static java.lang.Object reflectionFactory
private static java.lang.reflect.Method newConstructorAccessor
private static java.lang.reflect.Method newInstance
private static java.lang.reflect.Method newFieldAccessor
private static java.lang.reflect.Method fieldAccessorSet
private static boolean isSetup
private static java.lang.Class<?>[][] commonTypes
@Nullable public static EnumAction addAction(java.lang.String name)
@Nullable public static ItemArmor.ArmorMaterial addArmorMaterial(java.lang.String name, java.lang.String textureName, int durability, int[] reductionAmounts, int enchantability, SoundEvent soundOnEquip, float toughness)
@Nullable public static EntityPainting.EnumArt addArt(java.lang.String name, java.lang.String tile, int sizeX, int sizeY, int offsetX, int offsetY)
@Nullable public static EnumCreatureAttribute addCreatureAttribute(java.lang.String name)
@Nullable public static EnumCreatureType addCreatureType(java.lang.String name, java.lang.Class<? extends IAnimals> typeClass, int maxNumber, Material material, boolean peaceful, boolean animal)
@Nullable public static StructureStrongholdPieces.Stronghold.Door addDoor(java.lang.String name)
@Nullable public static EnumEnchantmentType addEnchantmentType(java.lang.String name, com.google.common.base.Predicate<Item> delegate)
@Nullable public static BlockPressurePlate.Sensitivity addSensitivity(java.lang.String name)
@Nullable public static RayTraceResult.Type addMovingObjectType(java.lang.String name)
@Nullable public static EnumSkyBlock addSkyBlock(java.lang.String name, int lightValue)
@Nullable public static EntityPlayer.SleepResult addStatus(java.lang.String name)
@Nullable public static Item.ToolMaterial addToolMaterial(java.lang.String name, int harvestLevel, int maxUses, float efficiency, float damage, int enchantability)
@Nullable @Deprecated public static EnumRarity addRarity(java.lang.String name, TextFormatting color, java.lang.String displayName)
IRarity
instead@Nullable public static EntityLiving.SpawnPlacementType addSpawnPlacementType(java.lang.String name, java.util.function.BiPredicate<IBlockAccess,BlockPos> predicate)
@Nullable public static HorseArmorType addHorseArmor(java.lang.String name, java.lang.String textureLocation, int armorStrength)
name
- the name of the new HorseArmorType
textureLocation
- the path to the texture for this armor type. It must follow the format domain:path and be relative to the assets folder.armorStrength
- how much protection this armor type should giveHorseArmorType
, or null if it could not be createdprivate static void setup()
private static java.lang.Object getConstructorAccessor(java.lang.Class<?> enumClass, java.lang.Class<?>[] additionalParameterTypes) throws java.lang.Exception
java.lang.Exception
private static <T extends java.lang.Enum<?>> T makeEnum(java.lang.Class<T> enumClass, @Nullable java.lang.String value, int ordinal, java.lang.Class<?>[] additionalTypes, @Nullable java.lang.Object[] additionalValues) throws java.lang.Exception
java.lang.Exception
public static void setFailsafeFieldValue(java.lang.reflect.Field field, @Nullable java.lang.Object target, @Nullable java.lang.Object value) throws java.lang.Exception
java.lang.Exception
private static void blankField(java.lang.Class<?> enumClass, java.lang.String fieldName) throws java.lang.Exception
java.lang.Exception
private static void cleanEnumCache(java.lang.Class<?> enumClass) throws java.lang.Exception
java.lang.Exception
@Nullable private static <T extends java.lang.Enum<?>> T addEnum(java.lang.Class<T> enumType, java.lang.String enumName, java.lang.Object... paramValues)
@Nullable protected static <T extends java.lang.Enum<?>> T addEnum(java.lang.Class<?>[][] map, java.lang.Class<T> enumType, java.lang.String enumName, java.lang.Object... paramValues)
public static void testEnum(java.lang.Class<? extends java.lang.Enum<?>> enumType, java.lang.Class<?>[] paramTypes)
@Nullable public static <T extends java.lang.Enum<?>> T addEnum(java.lang.Class<T> enumType, java.lang.String enumName, java.lang.Class<?>[] paramTypes, java.lang.Object... paramValues)
@Nullable private static <T extends java.lang.Enum<?>> T addEnum(boolean test, java.lang.Class<T> enumType, @Nullable java.lang.String enumName, java.lang.Class<?>[] paramTypes, @Nullable java.lang.Object[] paramValues)