本文整理汇总了Java中net.minecraft.item.ItemStack.addEnchantment方法的典型用法代码示例。如果您正苦于以下问题:Java ItemStack.addEnchantment方法的具体用法?Java ItemStack.addEnchantment怎么用?Java ItemStack.addEnchantment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.item.ItemStack
的用法示例。
在下文中一共展示了ItemStack.addEnchantment方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: enchantTool
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public static ItemStack enchantTool(ItemStack tool, ToolMaterial material) {
Item itemTool = tool.getItem();
if(itemTool instanceof TechnicalTool) {
if(material == UraniumDioxide) {
tool.addEnchantment(Technical.enchantmantRadioactivity, 1);
tool.addEnchantment(Enchantment.unbreaking, 2);
} else if(material == Barium)
tool.addEnchantment(Enchantment.unbreaking, 3);
else if(material == Chromium)
tool.addEnchantment(Enchantment.unbreaking, 4);
else if(material == Tungsten)
tool.addEnchantment(Enchantment.unbreaking, 5);
else if(material == Beryllium)
tool.addEnchantment(Enchantment.unbreaking, 10);
}
return tool;
}
示例2: addRandomEnchantment
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
* Applys a random enchantment to the specified item.
*/
public static ItemStack addRandomEnchantment(Random random, ItemStack p_77504_1_, int p_77504_2_, boolean allowTreasure)
{
boolean flag = p_77504_1_.getItem() == Items.BOOK;
List<EnchantmentData> list = buildEnchantmentList(random, p_77504_1_, p_77504_2_, allowTreasure);
if (flag)
{
p_77504_1_.setItem(Items.ENCHANTED_BOOK);
}
for (EnchantmentData enchantmentdata : list)
{
if (flag)
{
Items.ENCHANTED_BOOK.addEnchantment(p_77504_1_, enchantmentdata);
}
else
{
p_77504_1_.addEnchantment(enchantmentdata.enchantmentobj, enchantmentdata.enchantmentLevel);
}
}
return p_77504_1_;
}
示例3: getAllEnchantedBooks
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
private void getAllEnchantedBooks(Enchantment enchantment, NonNullList<ItemStack> list) {
for (int i = enchantment.getMinLevel(); i <= enchantment.getMaxLevel(); ++i) {
ItemStack itemstack = new ItemStack(Items.ENCHANTED_BOOK);
itemstack.addEnchantment(enchantment, i);
list.add(itemstack);
}
}
示例4: onItemUse
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if(!worldIn.isRemote&&worldIn.getBlockState(pos).getBlock()==ModBlocks.chalkBase)
{
TileEntityChalkBase te = (TileEntityChalkBase)worldIn.getTileEntity(pos);
DefaultDustSymbol startDust = te.getDustAt(hitX,hitZ);
if(startDust instanceof DustSymbolStart)
{
System.out.println("start script compilation");
ItemStack enchantItem = te.getItem();
if(enchantItem==null)return EnumActionResult.SUCCESS;
if(enchantItem.isItemEnchanted())return EnumActionResult.SUCCESS;
if (enchantItem.getTagCompound()==null)enchantItem.setTagCompound(new NBTTagCompound());
enchantItem.getTagCompound().setByteArray("omniScript",ModDust.getFormationArray((DustSymbolStart)startDust));
enchantItem.addEnchantment(ModEnchantment.runicenchantment, 1);
CompiledSymbol[] script = ModDust.getScriptFromItem(enchantItem);
//InventoryHelper.dropInventoryItems(worldIn, te.getPos(), te);
te.updateRendering();
return EnumActionResult.SUCCESS;
}
}
return EnumActionResult.PASS;
}
示例5: applyEnchant
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
private static ItemStack applyEnchant(ItemStack stack, Random random) {
if (RandoresProbability.percentChance(5, random)) {
stack.addEnchantment(EmpoweredEnchantment.INSTANCE, 1);
}
return stack;
}
示例6: addRandomEnchantment
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
* Adds a random enchantment to the specified item. Args: random, itemStack, enchantabilityLevel
*/
public static ItemStack addRandomEnchantment(Random p_77504_0_, ItemStack p_77504_1_, int p_77504_2_)
{
List<EnchantmentData> list = buildEnchantmentList(p_77504_0_, p_77504_1_, p_77504_2_);
boolean flag = p_77504_1_.getItem() == Items.book;
if (flag)
{
p_77504_1_.setItem(Items.enchanted_book);
}
if (list != null)
{
for (EnchantmentData enchantmentdata : list)
{
if (flag)
{
Items.enchanted_book.addEnchantment(p_77504_1_, enchantmentdata);
}
else
{
p_77504_1_.addEnchantment(enchantmentdata.enchantmentobj, enchantmentdata.enchantmentLevel);
}
}
}
return p_77504_1_;
}
示例7: getSubItems
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
ItemStack precision = new ItemStack(item);
precision.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
list.add(precision);
}
示例8: onCreated
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/** Makes your Item Enchanted when it is crafted */
public void onCreated(ItemStack item, World world, EntityPlayer player)
{
item.addEnchantment(Enchantment.efficiency, 10);
// Replace the "." after "Enchantment" to see options
// The number is the Enchantment Level
}
示例9: register
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
@Override
public void register(IModRegistry registry) {
this.registry = registry;
registry.handleRecipes(RitualRecipes.class, new JEIRitualHandler(), JEICategoryUIDs.RITUAL);
registry.handleRecipes(CauldronRecipes.class, new JEICauldronHandler(), JEICategoryUIDs.CAULDRON);
registry.handleRecipes(PedestalSlabRecipes.class, new JEIPedestalSlabHandler(), JEICategoryUIDs.PENDESTAL_SLAB);
registry.handleRecipes(HereticRitualRecipes.class, new JEIHereticRitualHandler(), JEICategoryUIDs.HERETIC_RITUAL);
registry.handleRecipes(MagicTableRecipe.class, new JEIMagicTableHandler(), JEICategoryUIDs.MAGIC_TABLE);
registry.getRecipeTransferRegistry().addRecipeTransferHandler(ContainerMagicTable.class, JEICategoryUIDs.MAGIC_TABLE, 0, 5, 5, 36);
registry.addRecipeClickArea(GuiMagicTable.class, 105, 77, 59, 34, JEICategoryUIDs.MAGIC_TABLE);
for(Item item : ForgeRegistries.ITEMS.getValues())
if(HarshenEnchantmetns.MIXUP.canApply(new ItemStack(item)))
{
if(item.isEnchantable(new ItemStack(item)))
continue;
ItemStack stack = new ItemStack(item);
stack.addEnchantment(HarshenEnchantmetns.MIXUP, 1);
registry.addAnvilRecipe(new ItemStack(item), HarshenUtils.toArray(HarshenUtils.getMixupBook()), HarshenUtils.toArray(stack));
}
registry.addRecipes(HarshenAPIHandler.allRitualRecipes, JEICategoryUIDs.RITUAL);
registry.addRecipes(HarshenAPIHandler.allCauldronRecipes, JEICategoryUIDs.CAULDRON);
registry.addRecipes(HarshenAPIHandler.allPedestalRecipes, JEICategoryUIDs.PENDESTAL_SLAB);
registry.addRecipes(HarshenAPIHandler.allHereticCauldronRecipes, JEICategoryUIDs.HERETIC_RITUAL);
registry.addRecipes(HarshenAPIHandler.allMagicTableRecipes, JEICategoryUIDs.MAGIC_TABLE);
registry.addRecipeCatalyst(new ItemStack(HarshenBlocks.HARSHEN_DIMENSIONAL_PEDESTAL), JEICategoryUIDs.RITUAL);
registry.addRecipeCatalyst(new ItemStack(HarshenItems.RITUAL_STICK), JEICategoryUIDs.CAULDRON);
registry.addRecipeCatalyst(new ItemStack(HarshenItems.RITUAL_STICK, 1, 1), JEICategoryUIDs.HERETIC_RITUAL);
registry.addRecipeCatalyst(new ItemStack(HarshenBlocks.PEDESTAL_SLAB), JEICategoryUIDs.PENDESTAL_SLAB);
registry.addRecipeCatalyst(new ItemStack(HarshenBlocks.HARSHEN_MAGIC_TABLE), JEICategoryUIDs.MAGIC_TABLE);
info(HarshenItems.HARSHEN_SOUL_FRAGMENT);
info(HarshenItems.HARSHEN_CRYSTAL);
info(HarshenItems.LIGHT_EMITTED_SEED);
info(HarshenItems.LIGHT_EMITTED_ESSENCE);
info(HarshenItems.SOUL_HARSHER_PICKAXE);
info(HarshenItems.PONTUS_WORLD_GATE_PARTS);
info(HarshenItems.BLOOD_ESSENCE);
info(HarshenItems.BLOOD_COLLECTOR);
info(HarshenItems.VALOR_BADGE);
info(HarshenItems.IRON_HEART);
info(HarshenItems.LIGHTNING_STAFF);
info(HarshenBlocks.BLOOD_VESSEL);
info(HarshenBlocks.HARSHEN_SOUL_FLOWER);
info(HarshenBlocks.BLOOD_BLOCK);
}
示例10: enchantItem
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
* Handles the given Button-click on the server, currently only used by enchanting. Name is for legacy.
*/
public boolean enchantItem(EntityPlayer playerIn, int id)
{
ItemStack itemstack = this.tableInventory.getStackInSlot(0);
ItemStack itemstack1 = this.tableInventory.getStackInSlot(1);
int i = id + 1;
if ((itemstack1 == null || itemstack1.stackSize < i) && !playerIn.capabilities.isCreativeMode)
{
return false;
}
else if (this.enchantLevels[id] > 0 && itemstack != null && (playerIn.experienceLevel >= i && playerIn.experienceLevel >= this.enchantLevels[id] || playerIn.capabilities.isCreativeMode))
{
if (!this.worldPointer.isRemote)
{
List<EnchantmentData> list = this.func_178148_a(itemstack, id, this.enchantLevels[id]);
boolean flag = itemstack.getItem() == Items.book;
if (list != null)
{
playerIn.removeExperienceLevel(i);
if (flag)
{
itemstack.setItem(Items.enchanted_book);
}
for (int j = 0; j < list.size(); ++j)
{
EnchantmentData enchantmentdata = (EnchantmentData)list.get(j);
if (flag)
{
Items.enchanted_book.addEnchantment(itemstack, enchantmentdata);
}
else
{
itemstack.addEnchantment(enchantmentdata.enchantmentobj, enchantmentdata.enchantmentLevel);
}
}
if (!playerIn.capabilities.isCreativeMode)
{
itemstack1.stackSize -= i;
if (itemstack1.stackSize <= 0)
{
this.tableInventory.setInventorySlotContents(1, (ItemStack)null);
}
}
playerIn.triggerAchievement(StatList.field_181739_W);
this.tableInventory.markDirty();
this.xpSeed = playerIn.getXPSeed();
this.onCraftMatrixChanged(this.tableInventory);
}
}
return true;
}
else
{
return false;
}
}
示例11: execute
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
* Callback for when the command is executed
*/
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
if (args.length < 2)
{
throw new WrongUsageException("commands.enchant.usage", new Object[0]);
}
else
{
EntityLivingBase entitylivingbase = (EntityLivingBase)getEntity(server, sender, args[0], EntityLivingBase.class);
sender.setCommandStat(CommandResultStats.Type.AFFECTED_ITEMS, 0);
Enchantment enchantment;
try
{
enchantment = Enchantment.getEnchantmentByID(parseInt(args[1], 0));
}
catch (NumberInvalidException var12)
{
enchantment = Enchantment.getEnchantmentByLocation(args[1]);
}
if (enchantment == null)
{
throw new NumberInvalidException("commands.enchant.notFound", new Object[] {Integer.valueOf(Enchantment.getEnchantmentID(enchantment))});
}
else
{
int i = 1;
ItemStack itemstack = entitylivingbase.getHeldItemMainhand();
if (itemstack == null)
{
throw new CommandException("commands.enchant.noItem", new Object[0]);
}
else if (!enchantment.canApply(itemstack))
{
throw new CommandException("commands.enchant.cantEnchant", new Object[0]);
}
else
{
if (args.length >= 3)
{
i = parseInt(args[2], enchantment.getMinLevel(), enchantment.getMaxLevel());
}
if (itemstack.hasTagCompound())
{
NBTTagList nbttaglist = itemstack.getEnchantmentTagList();
if (nbttaglist != null)
{
for (int j = 0; j < nbttaglist.tagCount(); ++j)
{
int k = nbttaglist.getCompoundTagAt(j).getShort("id");
if (Enchantment.getEnchantmentByID(k) != null)
{
Enchantment enchantment1 = Enchantment.getEnchantmentByID(k);
if (!enchantment.canApplyTogether(enchantment1) || !enchantment1.canApplyTogether(enchantment)) //Forge BugFix: Let Both enchantments veto being together
{
throw new CommandException("commands.enchant.cantCombine", new Object[] {enchantment.getTranslatedName(i), enchantment1.getTranslatedName(nbttaglist.getCompoundTagAt(j).getShort("lvl"))});
}
}
}
}
}
itemstack.addEnchantment(enchantment, i);
notifyCommandListener(sender, this, "commands.enchant.success", new Object[0]);
sender.setCommandStat(CommandResultStats.Type.AFFECTED_ITEMS, 1);
}
}
}
}
示例12: enchantItem
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
* enchants the item on the table using the specified slot; also deducts XP from player
*/
@Override
public boolean enchantItem(EntityPlayer player, int id) {
ItemStack var3 = tableInventory.getStackInSlot(0);
ItemStack var4 = tableInventory.getStackInSlot(1);
int var5 = id + 1;
if ((var4 == null || var4.stackSize < var5) && !player.capabilities.isCreativeMode)
return false;
else if (enchantLevels[id] > 0 && var3 != null && (player.experienceLevel >= var5 && player.experienceLevel >= enchantLevels[id] || player.capabilities.isCreativeMode)) {
if (!world.isRemote) {
List<EnchantmentData> var6 = func_178148_a(var3, id, enchantLevels[id]);
boolean var7 = var3.getItem() == Items.book;
if (var6 != null) {
chargeForEnchant(player, rand, var5);
if (var7)
var3.func_150996_a(Items.enchanted_book);
for (int var8 = 0; var8 < var6.size(); ++var8) {
EnchantmentData var9 = var6.get(var8);
if (var7)
Items.enchanted_book.addEnchantment(var3, var9);
else
var3.addEnchantment(var9.enchantmentobj, var9.enchantmentLevel);
}
if (!player.capabilities.isCreativeMode) {
var4.stackSize -= var5;
if (var4.stackSize <= 0)
tableInventory.setInventorySlotContents(1, (ItemStack) null);
}
tableInventory.markDirty();
enchantmentSeed = rand.nextInt();
onCraftMatrixChanged(tableInventory);
}
}
return true;
} else
return false;
}
示例13: init
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
public static void init() {
initEdibleMetals();
UCBaubles.initRecipes();
ItemStack precisionAxe = new ItemStack(UCItems.precisionAxe);
precisionAxe.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
ItemStack precisionShovel = new ItemStack(UCItems.precisionShovel);
precisionShovel.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
ItemStack precisionPick = new ItemStack(UCItems.precisionPick);
precisionPick.addEnchantment(Enchantment.getEnchantmentByID(33), 1);
GameRegistry.addRecipe(precisionAxe, "GG ", "GS ", " S ", 'G', UCItems.generic.createStack(EnumItems.PREGEM), 'S', Items.STICK);
GameRegistry.addRecipe(precisionPick, "GGG", " S ", " S ", 'G', UCItems.generic.createStack(EnumItems.PREGEM), 'S', Items.STICK);
GameRegistry.addRecipe(precisionShovel, " G ", " S ", " S ", 'G', UCItems.generic.createStack(EnumItems.PREGEM), 'S', Items.STICK);
GameRegistry.addShapelessRecipe(new ItemStack(UCItems.dietpills), UCItems.generic.createStack(EnumItems.ABSTRACT), UCItems.generic.createStack(EnumItems.ABSTRACT), Items.GLASS_BOTTLE);
GameRegistry.addShapelessRecipe(new ItemStack(UCItems.seedsAbstract), UCItems.generic.createStack(EnumItems.ABSTRACT));
GameRegistry.addRecipe(UCItems.generic.createStack(EnumItems.GUIDE), " N ", "WBM", " P ", 'N', new ItemStack(UCItems.seedsNormal), 'W', Items.WHEAT_SEEDS, 'M', Items.MELON_SEEDS, 'P', Items.PUMPKIN_SEEDS, 'B', Items.BOOK);
GameRegistry.addRecipe(UCItems.generic.createStack(EnumItems.EGGUPGRADE), "IEI", "EME", "IEI", 'I', Items.IRON_INGOT, 'E', Items.EGG, 'M', UCItems.generic.createStack(EnumItems.MILLENNIUMEYE));
GameRegistry.addRecipe(UCItems.generic.createStack(EnumItems.EASYBADGE), "GEG", "EQE", "GEG", 'G', Items.GOLD_INGOT, 'Q', Blocks.QUARTZ_BLOCK, 'E', UCItems.generic.createStack(EnumItems.MILLENNIUMEYE));
GameRegistry.addRecipe(new ItemStack(UCBlocks.lavalily), " C ", "CLC", " C ", 'C', UCItems.generic.createStack(EnumItems.CINDERLEAF), 'L', Blocks.WATERLILY);
GameRegistry.addRecipe(UCItems.generic.createStack(EnumItems.UPGRADE), " F ", "FBF", " F ", 'F', UCItems.generic.createStack(EnumItems.INVISIFEATHER), 'B', UCItems.generic.createStack(EnumItems.DISCOUNT));
GameRegistry.addRecipe(new ItemStack(UCItems.largeplum), "PPP", "PPP", "PPP", 'P', UCItems.generic.createStack(EnumItems.PLUM));
GameRegistry.addRecipe(new ItemStack(UCItems.goldenbread), "RRR", 'R', UCItems.generic.createStack(EnumItems.GOLDENRODS));
GameRegistry.addRecipe(UCItems.generic.createStack(EnumItems.WEEPINGEYE), "TTT", "TET", "TTT", 'T', UCItems.generic.createStack(EnumItems.WEEPINGTEAR), 'E', Items.ENDER_EYE);
GameRegistry.addRecipe(new ItemStack(UCItems.poncho), "P P", "PPP", "PPP", 'P', UCItems.generic.createStack(EnumItems.INVISIFEATHER));
GameRegistry.addRecipe(UCItems.generic.createStack(EnumItems.INVISIFEATHER), "TTT", "TFT", "TTT", 'T', UCItems.generic.createStack(EnumItems.INVISITWINE), 'F', Items.FEATHER);
GameRegistry.addRecipe(new ItemStack(UCItems.glasses3D), "I I", "I I", "BWR", 'I', Items.IRON_INGOT, 'R', new ItemStack(Blocks.STAINED_GLASS_PANE, 1, EnumDyeColor.RED.getMetadata()), 'W', new ItemStack(Blocks.WOOL, 1, EnumDyeColor.WHITE.getMetadata()), 'B', new ItemStack(Blocks.STAINED_GLASS_PANE, 1, EnumDyeColor.BLUE.getMetadata()));
GameRegistry.addRecipe(new ItemStack(UCItems.pixelglasses), "PPP", "PGP", "PPP", 'G', UCItems.glasses3D, 'P', UCItems.generic.createStack(EnumItems.PIXELS));
GameRegistry.addRecipe(UCItems.generic.createStack(EnumItems.TIMEMEAL, 3), " B ", "BCB", " B ", 'B', new ItemStack(Items.DYE, 1, EnumDyeColor.WHITE.getDyeDamage()), 'C', Items.CLOCK);
GameRegistry.addRecipe(new ItemStack(UCItems.endersnooker), "EPE", "PSP", "EPE", 'E', UCItems.generic.createStack(EnumItems.LILYTWINE), 'S', Items.STICK, 'P', Items.ENDER_PEARL);
GameRegistry.addRecipe(new ItemStack(Items.ENDER_PEARL), "EEE", "ESE", "EEE", 'E', UCItems.generic.createStack(EnumItems.LILYTWINE), 'S', Items.SNOWBALL);
GameRegistry.addRecipe(UCItems.generic.createStack(EnumItems.PREGEM), " N ", "NDN", " N ", 'N', UCItems.generic.createStack(EnumItems.PRENUGGET), 'D', Items.DIAMOND);
GameRegistry.addRecipe(new ItemStack(UCBlocks.hourglass), "DGD", "PDP", "DGD", 'G', Blocks.GOLD_BLOCK, 'P', Blocks.GLASS_PANE, 'D', UCItems.generic.createStack(EnumItems.TIMEDUST));
GameRegistry.addRecipe(new ItemStack(UCBlocks.totemhead), "LLL", "LML", " S ", 'L', Blocks.LAPIS_BLOCK, 'M', UCItems.generic.createStack(EnumItems.MILLENNIUMEYE), 'S', Items.STICK);
GameRegistry.addRecipe(UCItems.generic.createStack(EnumItems.EULA), " L ", "LBL", " L ", 'L', UCItems.generic.createStack(EnumItems.LEGALSTUFF), 'B', Items.BOOK);
GameRegistry.addRecipe(new ItemStack(UCItems.seedsArtisia), " S ", "SCS", " S ", 'S', UCItems.seedsNormal, 'C', Blocks.CRAFTING_TABLE);
GameRegistry.addRecipe(new DiscountBookRecipe());
BrewingRecipeRegistry.addRecipe(BrewingRecipeRegistry.getOutput(new ItemStack(Items.POTIONITEM), new ItemStack(Items.NETHER_WART)), UCItems.generic.createStack(EnumItems.TIMEDUST), new ItemStack(UCItems.potionreverse));
BrewingRecipeRegistry.addRecipe(new ItemStack(UCItems.potionreverse), new ItemStack(Items.GUNPOWDER), UCItems.generic.createStack(EnumItems.POTIONSPLASH));
for (EnumDyeColor dye : EnumDyeColor.values()) {
addSeedRecipe(getDyeCraftingResult(dye.getDyeDamage()), new ItemStack(Items.DYE, 1, dye.getMetadata()), UCItems.generic.createStack(EnumItems.ESSENCE), UCItems.generic.createStack(EnumItems.ESSENCE));
}
addSeedRecipe(new ItemStack(UCItems.seedsCinderbella), new ItemStack(Items.SUGAR), new ItemStack(Items.WHEAT_SEEDS), new ItemStack(UCItems.seedsNormal));
addSeedRecipe(new ItemStack(UCItems.seedsCollis), new ItemStack(Items.SUGAR), new ItemStack(UCItems.seedsNormal), new ItemStack(UCItems.seedsCinderbella));
addSeedRecipe(new ItemStack(UCItems.seedsDirigible), new ItemStack(Items.SUGAR), new ItemStack(Items.PUMPKIN_SEEDS), new ItemStack(UCItems.seedsCollis));
addSeedRecipe(new ItemStack(UCItems.seedsEnderlily), new ItemStack(Items.ENDER_EYE), new ItemStack(Items.ENDER_PEARL), new ItemStack(UCItems.seedsDirigible));
addSeedRecipe(new ItemStack(UCItems.seedsInvisibilia), new ItemStack(Items.SUGAR), new ItemStack(Blocks.GLASS), new ItemStack(UCItems.seedsCinderbella));
addSeedRecipe(new ItemStack(UCItems.seedsKnowledge), new ItemStack(Items.SUGAR), new ItemStack(Items.ENCHANTED_BOOK), new ItemStack(UCItems.seedsInvisibilia));
addSeedRecipe(new ItemStack(UCItems.seedsMaryjane), new ItemStack(Items.BLAZE_ROD), new ItemStack(Items.BLAZE_POWDER), new ItemStack(UCItems.seedsCollis));
addSeedRecipe(new ItemStack(UCItems.seedsMerlinia), new ItemStack(Items.PUMPKIN_SEEDS), UCItems.generic.createStack(EnumItems.TIMEMEAL), new ItemStack(UCItems.seedsEnderlily));
addSeedRecipe(new ItemStack(UCItems.seedsMillennium), new ItemStack(Items.CLOCK), new ItemStack(Items.PUMPKIN_SEEDS), new ItemStack(UCItems.seedsMerlinia));
addSeedRecipe(new ItemStack(UCItems.seedsMusica), new ItemStack(Blocks.JUKEBOX), new ItemStack(UCItems.seedsNormal), new ItemStack(UCItems.seedsMaryjane));
addSeedRecipe(new ItemStack(UCItems.seedsPrecision), new ItemStack(Items.GOLD_NUGGET), new ItemStack(UCItems.seedsCollis), new ItemStack(UCItems.seedsInvisibilia));
addSeedRecipe(new ItemStack(UCItems.seedsWeepingbells), new ItemStack(Items.GHAST_TEAR), new ItemStack(Items.MELON_SEEDS), new ItemStack(UCItems.seedsEnderlily));
addSeedRecipe(new ItemStack(UCItems.seedsAbstract), new ItemStack(Items.REEDS), new ItemStack(Blocks.STAINED_HARDENED_CLAY), new ItemStack(Blocks.WOOL));
addSeedRecipe(new ItemStack(UCItems.seedsCobblonia), new ItemStack(Blocks.COBBLESTONE), new ItemStack(Blocks.STONEBRICK), new ItemStack(UCItems.seedsNormal));
addSeedRecipe(new ItemStack(UCItems.seedsDyeius), new ItemStack(Blocks.WOOL), new ItemStack(Items.DYE), new ItemStack(UCItems.seedsAbstract));
addSeedRecipe(new ItemStack(UCItems.seedsEula), new ItemStack(Items.PAPER), new ItemStack(Items.BOOK), new ItemStack(UCItems.seedsCobblonia));
addSeedRecipe(new ItemStack(UCItems.seedsFeroxia), new ItemStack(Items.CLAY_BALL), new ItemStack(UCItems.seedsKnowledge), new ItemStack(UCItems.seedsWeepingbells));
addSeedRecipe(new ItemStack(UCItems.seedsWafflonia), new ItemStack(Items.WHEAT_SEEDS), new ItemStack(Items.BREAD), new ItemStack(Items.SUGAR));
addSeedRecipe(new ItemStack(UCItems.seedsPixelsius), new ItemStack(UCItems.seedsWafflonia), new ItemStack(Items.DYE, 1, EnumDyeColor.BLACK.getDyeDamage()), new ItemStack(Items.PAINTING));
addSeedRecipe(new ItemStack(UCItems.seedsDevilsnare), new ItemStack(UCItems.seedsPixelsius), new ItemStack(Items.STICK), new ItemStack(Blocks.LOG));
addSeedRecipe(new ItemStack(UCItems.seedsMalleatoris), new ItemStack(UCItems.seedsPrecision), new ItemStack(Blocks.ANVIL), new ItemStack(Items.IRON_INGOT));
addSeedRecipe(new ItemStack(UCItems.seedsPetramia), new ItemStack(UCItems.seedsCobblonia), new ItemStack(Blocks.OBSIDIAN), new ItemStack(Blocks.COBBLESTONE));
}
示例14: enchantItem
import net.minecraft.item.ItemStack; //导入方法依赖的package包/类
/**
* Handles the given Button-click on the server, currently only used by enchanting. Name is for legacy.
*/
public boolean enchantItem(EntityPlayer playerIn, int id)
{
ItemStack itemstack = this.tableInventory.getStackInSlot(0);
ItemStack itemstack1 = this.tableInventory.getStackInSlot(1);
int i = id + 1;
if ((itemstack1 == null || itemstack1.stackSize < i) && !playerIn.capabilities.isCreativeMode)
{
return false;
}
else if (this.enchantLevels[id] > 0 && itemstack != null && (playerIn.experienceLevel >= i && playerIn.experienceLevel >= this.enchantLevels[id] || playerIn.capabilities.isCreativeMode))
{
if (!this.worldPointer.isRemote)
{
List<EnchantmentData> list = this.getEnchantmentList(itemstack, id, this.enchantLevels[id]);
boolean flag = itemstack.getItem() == Items.BOOK;
if (list != null)
{
playerIn.removeExperienceLevel(i);
if (flag)
{
itemstack.setItem(Items.ENCHANTED_BOOK);
}
for (int j = 0; j < list.size(); ++j)
{
EnchantmentData enchantmentdata = (EnchantmentData)list.get(j);
if (flag)
{
Items.ENCHANTED_BOOK.addEnchantment(itemstack, enchantmentdata);
}
else
{
itemstack.addEnchantment(enchantmentdata.enchantmentobj, enchantmentdata.enchantmentLevel);
}
}
if (!playerIn.capabilities.isCreativeMode)
{
itemstack1.stackSize -= i;
if (itemstack1.stackSize <= 0)
{
this.tableInventory.setInventorySlotContents(1, (ItemStack)null);
}
}
playerIn.addStat(StatList.ITEM_ENCHANTED);
this.tableInventory.markDirty();
this.xpSeed = playerIn.getXPSeed();
this.onCraftMatrixChanged(this.tableInventory);
this.worldPointer.playSound((EntityPlayer)null, this.position, SoundEvents.BLOCK_ENCHANTMENT_TABLE_USE, SoundCategory.BLOCKS, 1.0F, this.worldPointer.rand.nextFloat() * 0.1F + 0.9F);
}
}
return true;
}
else
{
return false;
}
}