本文整理匯總了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});
}