本文整理汇总了Java中net.minecraftforge.common.util.EnumHelper.addEnum方法的典型用法代码示例。如果您正苦于以下问题:Java EnumHelper.addEnum方法的具体用法?Java EnumHelper.addEnum怎么用?Java EnumHelper.addEnum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.common.util.EnumHelper
的用法示例。
在下文中一共展示了EnumHelper.addEnum方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addArmorMaterial
import net.minecraftforge.common.util.EnumHelper; //导入方法依赖的package包/类
public static ItemArmor.ArmorMaterial addArmorMaterial(String enumName, String textureName, int durability, int[] reductionAmounts, int enchantability, SoundEvent soundOnEquip, float toughness) {
return EnumHelper.addEnum(ItemArmor.ArmorMaterial.class, enumName, new Class[] {
String.class,
Integer.TYPE,
int[].class,
Integer.TYPE,
SoundEvent.class,
Float.TYPE
}, new Object[] {
textureName,
Integer.valueOf(durability),
reductionAmounts,
Integer.valueOf(enchantability),
soundOnEquip,
Float.valueOf(toughness)
});
}
示例2: getType
import net.minecraftforge.common.util.EnumHelper; //导入方法依赖的package包/类
public static BiomeType getType(String name)
{
name = name.toUpperCase();
for (BiomeType t : values())
{
if (t.name().equals(name)) return t;
}
BiomeType ret = EnumHelper.addEnum(BiomeType.class, name, new Class[0], new Object[0]);
if (ret.ordinal() >= biomes.length)
{
biomes = Arrays.copyOf(biomes, ret.ordinal() + 1);
}
return ret;
}
示例3: getType
import net.minecraftforge.common.util.EnumHelper; //导入方法依赖的package包/类
/**
* Retrieves a Type value by name,
* if one does not exist already it creates one.
* This can be used as intermediate measure for modders to
* add their own category of Biome.
*
* There are NO naming conventions besides:
* MUST be all upper case (enforced by name.toUpper())
* NO Special characters. {Unenforced, just don't be a pain, if it becomes a issue I WILL
* make this RTE with no worry about backwards compatibility}
*
* Note: For performance sake, the return value of this function SHOULD be cached.
* Two calls with the same name SHOULD return the same value.
*
*
* @param name The name of this Type
* @return An instance of Type for this name.
*/
public static Type getType(String name, Type... subTypes)
{
name = name.toUpperCase();
for (Type t : values())
{
if (t.name().equals(name))
return t;
}
Type ret = EnumHelper.addEnum(Type.class, name, new Class[]{Type[].class}, new Object[]{subTypes});
if (ret.ordinal() >= typeInfoList.length)
{
typeInfoList = Arrays.copyOf(typeInfoList, ret.ordinal()+1);
}
for(BiomeInfo bInfo:biomeInfoMap.values())
{
if(bInfo != null)
{
EnumSet<Type> oldSet = bInfo.typeList;
bInfo.typeList = EnumSet.noneOf(Type.class);
bInfo.typeList.addAll(oldSet);
}
}
return ret;
}
示例4: init
import net.minecraftforge.common.util.EnumHelper; //导入方法依赖的package包/类
@Override
public void init(FMLInitializationEvent event)
{
Class[][] commonTypes =
{
{ MusicTicker.MusicType.class, ResourceLocation.class, int.class, int.class },
};
MUSIC_TYPE_MARS = EnumHelper.addEnum(commonTypes, MusicTicker.MusicType.class, "MARS_JC", new ResourceLocation(GalacticraftCore.ASSET_PREFIX, "galacticraft.musicSpace"), 12000, 24000);
ClientProxyCore.registerHandlers();
ClientProxyCore.registerTileEntityRenderers();
ClientProxyCore.registerBlockHandlers();
ClientProxyCore.setupCapes();
}
示例5: getType
import net.minecraftforge.common.util.EnumHelper; //导入方法依赖的package包/类
public static BiomeType getType(String name)
{
name = name.toUpperCase();
for (BiomeType t : values())
{
if (t.name().equals(name)) return t;
}
BiomeType ret = EnumHelper.addEnum(BiomeType.class, name, BiomeType.class);
if (ret.ordinal() >= biomes.length)
{
biomes = Arrays.copyOf(biomes, ret.ordinal());
}
return ret;
}
示例6: registerParticleTypes
import net.minecraftforge.common.util.EnumHelper; //导入方法依赖的package包/类
@Nullable
public static EnumParticleTypes registerParticleTypes(String name, Class factory, boolean ignoreRange) throws Exception {
AlchemyModLoader.checkState();
int id = EnumParticleTypes.values().length;
if (Always.runOnClient())
if (Tool.isInstance(IParticleFactory.class, factory))
Minecraft.getMinecraft().effectRenderer.registerParticle(id, (IParticleFactory) factory.newInstance());
else
AlchemyRuntimeException.onException(new RuntimeException(
"Class<" + factory.getName() + "> forgot to implement the Interface<" + IParticleFactory.class.getName() + "> ?"));
EnumParticleTypes type = EnumHelper.addEnum(EnumParticleTypes.class, name,
new Class[] { String.class, int.class, boolean.class }, name, id, ignoreRange);
EnumParticleTypes.PARTICLES.put(type.getParticleID(), type);
EnumParticleTypes.BY_NAME.put(type.getParticleName(), type);
return type;
}
示例7: makeJenkinsCI
import net.minecraftforge.common.util.EnumHelper; //导入方法依赖的package包/类
@Config.Handle(name = HANDLE_JENKINS_CI, type = Type.MAKE)
public static JenkinsCI makeJenkinsCI(String url) {
if (url.isEmpty())
return MICKEY;
String scheme, host;
int index = url.indexOf(SEPARATOT);
if (index == -1) {
scheme = "http";
host = url;
} else {
scheme = url.substring(0, index);
host = url.substring(index + SEPARATOT.length());
}
return EnumHelper.addEnum(JenkinsCI.class, "custom", TYPES, scheme, host);
}
示例8: init
import net.minecraftforge.common.util.EnumHelper; //导入方法依赖的package包/类
@Override
public void init(FMLInitializationEvent event) {
Class[][] commonTypes = { { MusicTicker.MusicType.class, ResourceLocation.class, int.class, int.class }, };
MUSIC_TYPE_SPACE = EnumHelper.addEnum(commonTypes, MusicTicker.MusicType.class, "SNOWSTORM", new ResourceLocation(MercuryCore.ASSET_PREFIX, "4space.musicSpace"), 12000, 24000);
ClientProxyCore.setupCapes();
super.init(event);
}
示例9: initBase
import net.minecraftforge.common.util.EnumHelper; //导入方法依赖的package包/类
public static void initBase(Property...props){
Rarity ALMOST_RARE = EnumHelper.addEnum(Rarity.class, "NEAR_RARE", new Class<?>[]{int.class}, 3);
bashWeight = EnchantmentHelper.build(props[0], "bash.weightless", BaseEnchantment.class, Battlegear.MODID+":bash_weightless", Rarity.UNCOMMON, 3, 15, 30);
bashPower = EnchantmentHelper.build(props[1], "bash.power", BaseEnchantment.class, Battlegear.MODID+":bash_power", Rarity.COMMON, 5, 10, 40);
bashDamage = EnchantmentHelper.build(props[2], "bash.damage", BaseEnchantment.class, Battlegear.MODID+":bash_damage", Rarity.VERY_RARE, 3, 15, 50);
shieldUsage = EnchantmentHelper.build(props[3], "shield.usage", BaseEnchantment.class, Battlegear.MODID+":shield_efficiency", Rarity.RARE, 5, 5, 30);
shieldRecover = EnchantmentHelper.build(props[4], "shield.recover", BaseEnchantment.class, Battlegear.MODID+":shield_recovery", ALMOST_RARE, 4, 20, 20);
bowLoot = EnchantmentHelper.build(props[5], "bow.loot", BaseEnchantment.class, Battlegear.MODID+":bow_luck", Rarity.RARE, 10, 50);
bowCharge = EnchantmentHelper.build(props[6], "bow.charge", BaseEnchantment.class, Battlegear.MODID+":bow_drawnback", Rarity.VERY_RARE, 20, 20);
}
示例10: addPattern
import net.minecraftforge.common.util.EnumHelper; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static void addPattern(String name, String id, ItemStack craftingItem) throws ClassNotFoundException {
EnumHelper.addEnum((Class<Enum<?>>) Class.forName("ganymedes01.etfuturum.tileentities.TileEntityBanner$EnumBannerPattern"), name.toUpperCase(), new Class[] { String.class, String.class, ItemStack.class }, new Object[] { name, id, craftingItem });
}
示例11: addBanner
import net.minecraftforge.common.util.EnumHelper; //导入方法依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public static void addBanner(String enumName, String textureName, String id, ItemStack recipeItem){
final Class<?>[] paramClasses = new Class[] { String.class, String.class, ItemStack.class };
EnumHelper.addEnum((Class)BannerPattern.class, enumName.toUpperCase(), (Class[])paramClasses, new Object[] { textureName, id, recipeItem });
}
示例12: getType
import net.minecraftforge.common.util.EnumHelper; //导入方法依赖的package包/类
/**
* Retrieves a Type value by name,
* if one does not exist already it creates one.
* This can be used as interm measure for modders to
* add there own category of Biome.
*
* There are NO naming conventions besides:
* MUST be all upper case (enforced by name.toUpper())
* NO Special characters. {Unenforced, just don't be a pain, if it becomes a issue I WILL
* make this RTE with no worry about backwards compatibility}
*
* Note: For performance sake, the return value of this function SHOULD be cached.
* Two calls with the same name SHOULD return the same value.
*
*
* @param name The name of this Type
* @return An instance of Type for this name.
*/
public static Type getType(String name, Type... subTypes)
{
name = name.toUpperCase();
for (Type t : values())
{
if (t.name().equals(name))
return t;
}
Type ret = EnumHelper.addEnum(Type.class, name, new Class[]{Type[].class}, new Object[]{subTypes});
if (ret.ordinal() >= typeInfoList.length)
{
typeInfoList = Arrays.copyOf(typeInfoList, ret.ordinal());
}
return ret;
}
示例13: createRenderType
import net.minecraftforge.common.util.EnumHelper; //导入方法依赖的package包/类
public static EnumBlockRenderType createRenderType(String name) {
return EnumHelper.addEnum(EnumBlockRenderType.class, name, new Class[0]);
}
示例14: createHorseArmorType
import net.minecraftforge.common.util.EnumHelper; //导入方法依赖的package包/类
@Nullable
public HorseArmorType createHorseArmorType (int strength, @Nonnull String name, @Nonnull String hash) {
return EnumHelper.addEnum(HorseArmorType.class, name.toUpperCase().replace(" ", "_"), new Class[] { int.class, String.class, String.class }, strength, name, hash);
}
示例15: addPattern
import net.minecraftforge.common.util.EnumHelper; //导入方法依赖的package包/类
public static void addPattern(String name, String id, ItemStack craftingItem) {
name = "extrafood_" + name;
id = "ef_" + id;
EnumHelper.addEnum(TileEntityBanner.EnumBannerPattern.class, name.toUpperCase(), new Class[]{String.class, String.class, ItemStack.class}, new Object[]{name, id, craftingItem});
}