本文整理匯總了Java中net.minecraftforge.common.util.EnumHelper類的典型用法代碼示例。如果您正苦於以下問題:Java EnumHelper類的具體用法?Java EnumHelper怎麽用?Java EnumHelper使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
EnumHelper類屬於net.minecraftforge.common.util包,在下文中一共展示了EnumHelper類的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: MaterialDefinition
import net.minecraftforge.common.util.EnumHelper; //導入依賴的package包/類
@SerializationConstructor
public MaterialDefinition(@Name("color") Color color, @Name("name") String name, @Name("ore") OreComponent ore, @Name("components") List<CraftableComponent> craftables, @Name("properties") List<MaterialProperty> properties, @Name("abilities") AbilitySeries series) {
this.abilitySeries = series;
this.color = color;
this.ore = ore;
this.material = ore.getMaterial();
this.craftables = craftables;
this.name = name;
this.toolMaterial = EnumHelper.addToolMaterial(this.name, this.material.getHarvestLevel(), this.material.getMaxUses(), this.material.getEfficiency(), this.material.getDamage(), this.material.getEnchantability());
this.totalArmor = sum(this.material.getArmorReduction());
this.armorMaterial = EnumHelper.addArmorMaterial(this.name, "randores:armor", this.material.getMaxUses() / 10, this.material.getArmorReduction(), this.material.getEnchantability(), SoundEvents.ITEM_ARMOR_EQUIP_IRON, this.material.getToughness());
this.components = new ArrayList<>();
this.components.addAll(this.craftables);
this.components.add(this.ore);
this.components.add(this.material);
this.propertiesList = properties;
this.properties = new HashMap<>();
for (MaterialProperty property : properties) {
this.properties.put(property.name(), property);
}
}
示例3: 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;
}
示例4: 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;
}
示例5: setupMaterials
import net.minecraftforge.common.util.EnumHelper; //導入依賴的package包/類
private static void setupMaterials() {
// regular materials
advancedWood = EnumHelper.addToolMaterial("advancedWood", 1, 236, 8.0F, 1.75F, 8);
(advancedStone = EnumHelper.addToolMaterial("advancedStone", 2, 524, 12.0F, 3.0F, 3)).setRepairItem(new ItemStack(ACBlocks.advancedStone));
(advancedIron = EnumHelper.addToolMaterial("advancedIron", 3, 2250, 18.0F, 10.0F, 7)).setRepairItem(new ItemStack(Blocks.IRON_BLOCK));
(advancedGold = EnumHelper.addToolMaterial("advancedGold", 2, 1561, 8.0F, 6.0F, 15)).setRepairItem(new ItemStack(Blocks.GOLD_BLOCK));
(advancedEmerald = EnumHelper.addToolMaterial("advancedEmerald", 4, 3122, 12.0F, ACConfig.emeraldSwordDamage - 4, 22)).setRepairItem(new ItemStack(Blocks.EMERALD_BLOCK));
(advancedDiamond = EnumHelper.addToolMaterial("advancedDiamond", 4, 8192, 24.0F, 20.0F, 5)).setRepairItem(new ItemStack(Blocks.DIAMOND_BLOCK));
(netherStar = EnumHelper.addToolMaterial("netherStar", 4, 9366, 20.0F, 26.0F, 1)).setRepairItem(new ItemStack(Items.NETHER_STAR));
(advancedNetherStar = EnumHelper.addToolMaterial("advancedNetherStar", 5, 16384, 30.0F, 56.0F, 0)).setRepairItem(new ItemStack(ACBlocks.netherStarBlock));
creative = EnumHelper.addToolMaterial("creative_", 1000, 1, 0, 0, 0);
// thaumic materials
// advancedThaumium = EnumHelper.addToolMaterial("advancedThaumium", 3, 2250, 18.0F, 11.0F, 12);
// advancedElemental = EnumHelper.addToolMaterial("advancedElemental", 4, 6144, 24.0F, 22.0F, 8);
// advancedVoid = EnumHelper.addToolMaterial("advancedVoid", 4, 524, 18.0F, 24.0F, 12);
// advancedCrimson = EnumHelper.addToolMaterial("advancedCrimson", 4, 668, 20.0F, 30.0F, 12);
// advancedPrimal = EnumHelper.addToolMaterial("advancedPrimal", 5, 937, 22.0F, 36.0F, 12);
// if(ASModIntegration.thaumcraftExists) {
// advancedThaumium.setRepairItem(new ItemStack(BlocksTC.metal, 1, 0));
// advancedVoid.setRepairItem(new ItemStack(BlocksTC.metal, 1, 1));
// }
}
示例6: 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();
}
示例7: initItems
import net.minecraftforge.common.util.EnumHelper; //導入依賴的package包/類
@Override
public void initItems() {
venusItem = new ItemBasics("venusItem", VenusCore.instance.prefixTexture, new String[] {
"sulfurDust",
"ingotSulfur",
"ruby",
"ingotUranium",
"pellucidum",
"sulfurPlate",
"rubyPlate",
"uraniumPlate",
"tier4HeavyDutyPlate",
"venusRod",
"venusRodDust",
"powerPellucidum",
"ventBerry",
});
batteryUranium = new ItemBattery(VenusCore.instance.prefixTexture, "batteryUranium", 75000.0f);
batterySulfur = new ItemBattery(VenusCore.instance.prefixTexture, "batterySulfur", 17500.0f);
armourRuby = new ItemSetArmour(VenusCore.instance.prefixTexture, EnumHelper.addArmorMaterial("ruby", 30, new int[] { 3, 8, 6, 3 }, 12));
armourSulfur = new ItemSetArmour(VenusCore.instance.prefixTexture, EnumHelper.addArmorMaterial("sulfur", 15, new int[] { 1, 4, 2, 1 }, 7));
toolsRuby = new ItemSetTools(VenusCore.instance.prefixTexture, EnumHelper.addToolMaterial("ruby", 3, 768, 5.0f, 2, 8));
toolsSulfur = new ItemSetTools(VenusCore.instance.prefixTexture, EnumHelper.addToolMaterial("sulfur", 3, 416, 6.0f, 1, 2));
}
示例8: 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;
}
示例9: init
import net.minecraftforge.common.util.EnumHelper; //導入依賴的package包/類
private void init() {
teambattleingotraw = new ItemTeambattleIngot().setUnlocalizedName("teambattleingotraw").setCreativeTab(TeambattleMod.tab);
teambattleingot = new ItemTeambattleIngot().setUnlocalizedName("teambattleingot").setCreativeTab(TeambattleMod.tab);
teambattletool = EnumHelper.addToolMaterial("TEAMBATTLE", 3, 50000000, 10.0F, 5.0F, 25);
teambattlearmor = EnumHelper.addArmorMaterial("TEAMBATTLE", "", 3125000, new int[] { 3, 8, 6, 3 }, 25);
teambattletool.setRepairItem(new ItemStack(teambattleingot));
teambattlearmor.customCraftingMaterial = teambattleingot;
teambattlesword = new ItemTeambattleSword(teambattletool).setUnlocalizedName("teambattlesword").setCreativeTab(TeambattleMod.tab);
teambattlepickaxe = new ItemTeambattlePickaxe(teambattletool).setUnlocalizedName("teambattlepickaxe").setCreativeTab(TeambattleMod.tab);
teambattleshovel = new ItemTeambattleShovel(teambattletool).setUnlocalizedName("teambattleshovel").setCreativeTab(TeambattleMod.tab);
teambattlebow = new ItemTeambattleBow().setUnlocalizedName("teambattlebow").setCreativeTab(TeambattleMod.tab);
teambattlehelmet = new ItemTeambattleArmor(teambattlearmor, 0).setUnlocalizedName("teambattlehelmet").setCreativeTab(TeambattleMod.tab);
teambattlechestplate = new ItemTeambattleArmor(teambattlearmor, 1).setUnlocalizedName("teambattlechestplate").setCreativeTab(TeambattleMod.tab);
teambattleleggings = new ItemTeambattleArmor(teambattlearmor, 2).setUnlocalizedName("teambattleleggings").setCreativeTab(TeambattleMod.tab);
teambattleboots = new ItemTeambattleArmor(teambattlearmor, 3).setUnlocalizedName("teambattleboots").setCreativeTab(TeambattleMod.tab);
teambattlebackpack = new ItemTeambattleBackpack().setUnlocalizedName("teambattlebackpack").setCreativeTab(TeambattleMod.tab);
teambattlehangglider = new ItemTeambattleHangglider().setUnlocalizedName("teambattlehangglider").setCreativeTab(TeambattleMod.tab);
}
示例10: 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;
}
示例11: ItemMHSword
import net.minecraftforge.common.util.EnumHelper; //導入依賴的package包/類
public ItemMHSword(String itemName, float damage, int... sharpnessDamageLevels)
{
super(EnumHelper.addToolMaterial(itemName + "Mat", 0, sharpnessDamageLevels[sharpnessDamageLevels.length - 1], 0, damage - 1, 0).setRepairItem(new ItemStack(MHItems.itemMisc, 1, 1)));
setCreativeTab(MobHunter.MHWEAPON_TAB);
setUnlocalizedName(itemName);
setRegistryName(itemName);
maxSharpness = EnumSharpness.getById(sharpnessDamageLevels.length - 1);
if(maxSharpness == null) LogHelper.warn("Sword " + getUnlocalizedName() + " has a null sharpness! Something must be wrong!");
damageLevels = sharpnessDamageLevels;
String levels = "";
for(int i = 0; i < damageLevels.length; i++)
{
levels += damageLevels[i];
if(i < damageLevels.length - 1)
levels += " <- ";
}
damageLevelsString = levels;
}
示例12: registerItems
import net.minecraftforge.common.util.EnumHelper; //導入依賴的package包/類
@SubscribeEvent
public static void registerItems(RegistryEvent.Register<Item> event) {
event.getRegistry().register(new ItemAshPile("ash_pile"));
event.getRegistry().register(new ItemCoiledSword("coiled_sword", EnumHelper.addToolMaterial("COILED_SWORD", 3, 105, 3, 10, 0)));
event.getRegistry().register(new ItemEstusFlask("estus_flask", 0, 0, false));
event.getRegistry().register(new ItemHomewardBone("homeward_bone"));
event.getRegistry().register(new ItemCoiledSwordFragment("coiled_sword_fragment"));
event.getRegistry().register(new ItemEstusShard("estus_shard"));
event.getRegistry().register(new ItemTitaniteShard("titanite_shard"));
event.getRegistry().register(new ItemLargeTitaniteShard("large_titanite_shard"));
event.getRegistry().register(new ItemTitaniteChunk("titanite_chunk"));
event.getRegistry().register(new ItemTitaniteSlab("titanite_slab"));
event.getRegistry().register(new ItemUndeadBoneShard("undead_bone_shard"));
if (ashBlock.getRegistryName() != null)
event.getRegistry().register(new ItemBlock(ashBlock).setRegistryName(ashBlock.getRegistryName()));
if (ashBonePile.getRegistryName() != null)
event.getRegistry().register(new ItemBlock(ashBonePile).setRegistryName(ashBonePile.getRegistryName()));
}
示例13: setupMaterials
import net.minecraftforge.common.util.EnumHelper; //導入依賴的package包/類
/** Set up tool and armor materials */
private static void setupMaterials() {
// tools
elecMat = EnumHelper.addToolMaterial("Electricium", 4, 3000, 14.0f, 5.0f, 22);
elecHammerMat = EnumHelper.addToolMaterial("Electricium Hammer", 4, 3500, 16.0f, 9.0f, 22);
skyMat = EnumHelper.addToolMaterial("Skyfather", 5, 3500, 18.0f, 6.5f, 30);
skyHammerMat = EnumHelper.addToolMaterial("Skyfather Hammer", 5, 3500, 18.0f, 12.0f, 30);
mysticMat = EnumHelper.addToolMaterial("Mystic", 6, 4000, 18.0f, 8.0f, 30);
mysticHammerMat = EnumHelper.addToolMaterial("Mystic Hammer", 6, 4000, 18.0f, 15.0f, 30);
kineticMat = EnumHelper.addToolMaterial("Kinetic Shard", 3, 100, 1.0f, 0.0f, 1);
// special tools
soulMat = EnumHelper.addToolMaterial("Soul", 1, 150, 4.0F, 1.5F, 10);
zombieMat = EnumHelper.addToolMaterial("Zombie", 1, 131, 4.0F, 1.0F, 10);
featherMat = EnumHelper.addToolMaterial("Feather", 1, 131, 4.0F, 1.0F, 10);
enderMat = EnumHelper.addToolMaterial("Ender", 1, 200, 4.0F, 1.5F, 10);
blazeMat = EnumHelper.addToolMaterial("Blaze", 1, 150, 4.0F, 1.0F, 10);
iceMat = EnumHelper.addToolMaterial("Ice", 1, 100, 4.0F, 0.5F, 10);
// armor
elecArmor = ArmorHelper.addArmorMaterial("Electricium", RefStrings.MODID + ":elecArmor", 40, new int[]{3, 6, 8, 4}, 25, SoundEvents.ITEM_ARMOR_EQUIP_GOLD, 2F);
skyArmor = ArmorHelper.addArmorMaterial("Skyfather", RefStrings.MODID + ":skyArmor", 50, new int[]{3, 7, 8, 4}, 20, SoundEvents.ITEM_ARMOR_EQUIP_GOLD, 2.5F);
mysticArmor = ArmorHelper.addArmorMaterial("Mystic", RefStrings.MODID + ":mysticArmor", 60, new int[]{4, 7, 8, 4}, 15, SoundEvents.ITEM_ARMOR_EQUIP_GOLD, 3F);
kineticArmor = ArmorHelper.addArmorMaterial("Kinetic", RefStrings.MODID + ":kineticArmor", 4, new int[]{1, 3, 5, 2}, 1, SoundEvents.ITEM_ARMOR_EQUIP_GOLD, 0F);
}
示例14: registerPurpleMaterial
import net.minecraftforge.common.util.EnumHelper; //導入依賴的package包/類
private static void registerPurpleMaterial() {
ArmorMaterial mimicArmor = ArmorMaterial.DIAMOND;
MaterialRegistry.powerArmorMaterial = EnumHelper.addArmorMaterial(MATERIALNAME, Const.MODRES + MATERIALNAME,
diamondDurability * 2, // affects DURABILITY . 15 is the same as iron
new int[] {
mimicArmor.getDamageReductionAmount(EntityEquipmentSlot.FEET) + 1,
mimicArmor.getDamageReductionAmount(EntityEquipmentSlot.LEGS) + 1,
mimicArmor.getDamageReductionAmount(EntityEquipmentSlot.CHEST) + 1,
mimicArmor.getDamageReductionAmount(EntityEquipmentSlot.HEAD) + 2
},
mimicArmor.getEnchantability() / 4,
mimicArmor.getSoundEvent(),
mimicArmor.getToughness() + 2);
MaterialRegistry.powerArmorMaterial.repairMaterial = new ItemStack(Blocks.OBSIDIAN);
//now the tool material
MaterialRegistry.powerToolMaterial = EnumHelper.addToolMaterial(MATERIALNAME,
ToolMaterial.DIAMOND.getHarvestLevel(),
ToolMaterial.DIAMOND.getMaxUses() * 4, //was - 261
ToolMaterial.DIAMOND.getEfficiencyOnProperMaterial(),
ToolMaterial.DIAMOND.getDamageVsEntity() * 8, //best draconic evolution sword is 35 base, so this is not that crazy
ToolMaterial.GOLD.getEnchantability() * 2);
MaterialRegistry.powerToolMaterial.setRepairItem(MaterialRegistry.powerArmorMaterial.repairMaterial);
}
示例15: registerEmeraldMaterial
import net.minecraftforge.common.util.EnumHelper; //導入依賴的package包/類
private static void registerEmeraldMaterial() {
MaterialRegistry.emeraldArmorMaterial = EnumHelper.addArmorMaterial(emeraldName, Const.MODRES + emeraldName,
diamondDurability + 30, //was -2 affects DURABILITY
new int[] {
ArmorMaterial.DIAMOND.getDamageReductionAmount(EntityEquipmentSlot.FEET),
ArmorMaterial.DIAMOND.getDamageReductionAmount(EntityEquipmentSlot.LEGS),
ArmorMaterial.DIAMOND.getDamageReductionAmount(EntityEquipmentSlot.CHEST),
ArmorMaterial.DIAMOND.getDamageReductionAmount(EntityEquipmentSlot.HEAD)
},
ArmorMaterial.GOLD.getEnchantability(),
ArmorMaterial.DIAMOND.getSoundEvent(),
ArmorMaterial.DIAMOND.getToughness() + 1);//was / 2
MaterialRegistry.emeraldArmorMaterial.repairMaterial = new ItemStack(Items.EMERALD);
//max uses is durability ex The number of uses this material allows.
//as of 1.9.4 : (wood = 59, stone = 131, iron = 250, diamond = 1561, gold = 32)
MaterialRegistry.emeraldToolMaterial = EnumHelper.addToolMaterial(emeraldName,
ToolMaterial.DIAMOND.getHarvestLevel(),
ToolMaterial.DIAMOND.getMaxUses(), //was - 261
ToolMaterial.DIAMOND.getEfficiencyOnProperMaterial(),
ToolMaterial.DIAMOND.getDamageVsEntity(), //was - 0.25F
ToolMaterial.GOLD.getEnchantability());
MaterialRegistry.emeraldToolMaterial.setRepairItem(MaterialRegistry.emeraldArmorMaterial.repairMaterial);
}