类的使用
org.bukkit.inventory.ItemStack
程序包
说明
Bukkit的常用类.
用于操作在
世界
内的三位像素(方块),包括一些特定的状态.专门用于处理插件运行时配置的类.
为在
世界
内存在的非三维像素单位(实体)提供的接口,包含玩家、怪物、抛射物等.参与操作玩家物品栏和物品交互的类.
代表每种体素(意义可参考维基百科或百度百科相关条目,即物品被抽象为体素)的种类和状态.
代表每种
药水
属性和操作的类的集合.-
org.bukkit中ItemStack的使用
修饰符和类型方法说明在指定的位置
丢出一个物品.World.dropItemNaturally
(Location location, ItemStack item) 在指定的位置
丢出一个随机偏移的物品.Bukkit.getRecipesFor
(ItemStack result) Get a list of all recipes for a given item.Server.getRecipesFor
(ItemStack result) 获取一个合成ItemStack的所有配方,如果副ID为-1将匹配所有的数据值UnsafeValues.modifyItemStack
(ItemStack stack, String arguments) 已过时。 -
org.bukkit.block中ItemStack的使用
修饰符和类型方法说明Block.getDrops()
Returns a list of items which would drop by destroying this blockReturns a list of items which would drop by destroying this block with a specific tool修饰符和类型方法说明boolean
Block.breakNaturally
(ItemStack tool) Breaks the block and spawns items as if a player had digged it with a specific toolReturns a list of items which would drop by destroying this block with a specific tool -
org.bukkit.configuration中ItemStack的使用
修饰符和类型方法说明ConfigurationSection.getItemStack
(String path) 在指定路径获取一个ItemStack
类型的值.ConfigurationSection.getItemStack
(String path, ItemStack def) 在指定路径上获取一个ItemStack
, 如果无法获取, 则直接返回默认值.MemorySection.getItemStack
(String path) MemorySection.getItemStack
(String path, ItemStack def) 修饰符和类型方法说明ConfigurationSection.getItemStack
(String path, ItemStack def) 在指定路径上获取一个ItemStack
, 如果无法获取, 则直接返回默认值.MemorySection.getItemStack
(String path, ItemStack def) -
org.bukkit.enchantments中ItemStack的使用
修饰符和类型方法说明abstract boolean
Enchantment.canEnchantItem
(ItemStack item) 检查该附魔支不支持某物品.boolean
EnchantmentWrapper.canEnchantItem
(ItemStack item) boolean
检查是否包含该物品. -
org.bukkit.entity中ItemStack的使用
修饰符和类型方法说明ArmorStand.getBoots()
返回盔甲架当前穿在脚上的物品.ArmorStand.getChestplate()
返回盔甲架当前穿在胸上的物品.ArmorStand.getHelmet()
返回盔甲架当前戴在头上的物品.ItemFrame.getItem()
获取在展示框内的物品.ThrownPotion.getItem()
Returns a copy of the ItemStack for this thrown potion.ArmorStand.getItemInHand()
返回盔甲架当前握持的物品.HumanEntity.getItemInHand()
已过时。HumanEntity.getItemOnCursor()
返回你的鼠标正在拖动的物品, 可能为空.Item.getItemStack()
Gets the item stack associated with this item drop.ArmorStand.getLeggings()
返回盔甲架当前穿在腿上的物品.修饰符和类型方法说明void
设置盔甲架当前穿在脚上的物品.void
ArmorStand.setChestplate
(ItemStack item) 设置盔甲架当前穿在胸上的物品.void
设置盔甲架当前戴在头上的物品.void
设置在展示框内的物品.void
Set the ItemStack for this thrown potion.void
ArmorStand.setItemInHand
(ItemStack item) 设置盔甲架当前握持的物品.void
HumanEntity.setItemInHand
(ItemStack item) 已过时。人类现能双持, 请使用PlayerInventory
中更明确的方法void
HumanEntity.setItemOnCursor
(ItemStack item) 设置你正在拖动的物品, 将替换你所拖动的任何物品.void
Item.setItemStack
(ItemStack stack) Sets the item stack associated with this item drop.void
ArmorStand.setLeggings
(ItemStack item) 设置盔甲架当前穿在腿上的物品. -
org.bukkit.event.block中ItemStack的使用
修饰符和类型方法说明BlockDispenseEvent.getItem()
获取被射出的物品.BlockDamageEvent.getItemInHand()
获取当前玩家手上的物品.BlockPlaceEvent.getItemInHand()
获取玩家放置的方块的物品形式(在玩家手上).限定符构造器说明BlockDamageEvent
(Player player, Block block, ItemStack itemInHand, boolean instaBreak) BlockDispenseEvent
(Block block, ItemStack dispensed, Vector velocity) BlockMultiPlaceEvent
(List<BlockState> states, Block clicked, ItemStack itemInHand, Player thePlayer, boolean canBuild) BlockPlaceEvent
(Block placedBlock, BlockState replacedBlockState, Block placedAgainst, ItemStack itemInHand, Player thePlayer, boolean canBuild) 已过时。BlockPlaceEvent
(Block placedBlock, BlockState replacedBlockState, Block placedAgainst, ItemStack itemInHand, Player thePlayer, boolean canBuild, EquipmentSlot hand) -
org.bukkit.event.enchantment中ItemStack的使用
修饰符和类型方法说明EnchantItemEvent.getItem()
获取被附魔的物品(可自定义)。PrepareItemEnchantEvent.getItem()
获取准备附魔的物品(可改动).限定符构造器说明EnchantItemEvent
(Player enchanter, InventoryView view, Block table, ItemStack item, int level, Map<Enchantment, Integer> enchants, int i) PrepareItemEnchantEvent
(Player enchanter, InventoryView view, Block table, ItemStack item, EnchantmentOffer[] offers, int bonus) -
org.bukkit.event.entity中ItemStack的使用
修饰符和类型方法说明EntityShootBowEvent.getBow()
Gets the bow ItemStack used to fire the arrow.EntityBreedEvent.getBredWith()
The ItemStack that was used to initiate breeding, if present.限定符构造器说明EntityBreedEvent
(LivingEntity child, LivingEntity mother, LivingEntity father, LivingEntity breeder, ItemStack bredWith, int experience) EntityShootBowEvent
(LivingEntity shooter, ItemStack bow, Projectile projectile, float force) 限定符构造器说明EntityDeathEvent
(LivingEntity entity, List<ItemStack> drops) EntityDeathEvent
(LivingEntity what, List<ItemStack> drops, int droppedExp) PlayerDeathEvent
(Player player, List<ItemStack> drops, int droppedExp, int newExp, int newTotalExp, int newLevel, String deathMessage) PlayerDeathEvent
(Player player, List<ItemStack> drops, int droppedExp, int newExp, String deathMessage) PlayerDeathEvent
(Player player, List<ItemStack> drops, int droppedExp, String deathMessage) -
org.bukkit.event.inventory中ItemStack的使用
修饰符和类型方法说明InventoryClickEvent.getCurrentItem()
获取被点击的格子的物品InventoryClickEvent.getCursor()
获取当前光标所指的物品InventoryCreativeEvent.getCursor()
InventoryDragEvent.getCursor()
Gets the result cursor after the drag is done.BrewingStandFuelEvent.getFuel()
Gets the ItemStack of the fuel before the amount was subtracted.FurnaceBurnEvent.getFuel()
获取这个事件中的燃料.InventoryMoveItemEvent.getItem()
Gets the ItemStack being moved; if modified, the original item will not be removed from the source inventory.InventoryDragEvent.getOldCursor()
Gets an ItemStack representing the cursor prior to any modifications as a result of this drag.FurnaceSmeltEvent.getResult()
获取熔炼产物.PrepareAnvilEvent.getResult()
获取预合成时铁砧即将打造出来的物品,可能为空.FurnaceSmeltEvent.getSource()
获取被熔炼的物品.修饰符和类型方法说明InventoryDragEvent.getNewItems()
Gets all items to be added to the inventory in this drag.修饰符和类型方法说明void
InventoryClickEvent.setCurrentItem
(ItemStack stack) Sets the ItemStack currently in the clicked slot.void
已过时。This changes the ItemStack in their hand before any calculations are applied to the Inventory, which has a tendency to create inconsistencies between the Player and the server, and to make unexpected changes in the behavior of the clicked Inventory.void
void
Sets the result cursor after the drag is done.void
Sets the ItemStack being moved; if this is different from the original ItemStack, the original item will not be removed from the source inventory.void
设置熔炼产物.void
限定符构造器说明BrewingStandFuelEvent
(Block brewingStand, ItemStack fuel, int fuelPower) FurnaceBurnEvent
(Block furnace, ItemStack fuel, int burnTime) FurnaceSmeltEvent
(Block furnace, ItemStack source, ItemStack result) InventoryCreativeEvent
(InventoryView what, InventoryType.SlotType type, int slot, ItemStack newItem) InventoryDragEvent
(InventoryView what, ItemStack newCursor, ItemStack oldCursor, boolean right, Map<Integer, ItemStack> slots) InventoryMoveItemEvent
(Inventory sourceInventory, ItemStack itemStack, Inventory destinationInventory, boolean didSourceInitiate) PrepareAnvilEvent
(InventoryView inventory, ItemStack result) 限定符构造器说明InventoryDragEvent
(InventoryView what, ItemStack newCursor, ItemStack oldCursor, boolean right, Map<Integer, ItemStack> slots) -
org.bukkit.event.player中ItemStack的使用
修饰符和类型方法说明PlayerArmorStandManipulateEvent.getArmorStandItem()
Returns the item held by the armor stand.PlayerItemBreakEvent.getBrokenItem()
获得因耐久值不足将要被销毁的物品.PlayerInteractEvent.getItem()
获取本事件玩家手中的物品, 手中物品为空时会返回nullPlayerItemConsumeEvent.getItem()
Gets the item that is being consumed.PlayerItemMendEvent.getItem()
Get theItemStack
to be repaired.PlayerBucketEvent.getItemStack()
得到使用桶之后会得到的物品堆叠.PlayerSwapHandItemsEvent.getMainHandItem()
获取切换到主手的物品.PlayerSwapHandItemsEvent.getOffHandItem()
获取切换到副手的物品.PlayerArmorStandManipulateEvent.getPlayerItem()
Returns the item held by the player.修饰符和类型方法说明void
Set the item being consumedvoid
PlayerBucketEvent.setItemStack
(ItemStack itemStack) 设置使用桶之后得到的物品.void
PlayerSwapHandItemsEvent.setMainHandItem
(ItemStack mainHandItem) 设置主手里的物品.void
PlayerSwapHandItemsEvent.setOffHandItem
(ItemStack offHandItem) 设置副手里的物品.限定符构造器说明PlayerArmorStandManipulateEvent
(Player who, ArmorStand clickedEntity, ItemStack playerItem, ItemStack armorStandItem, EquipmentSlot slot) PlayerBucketEmptyEvent
(Player who, Block blockClicked, BlockFace blockFace, Material bucket, ItemStack itemInHand) PlayerBucketEvent
(Player who, Block blockClicked, BlockFace blockFace, Material bucket, ItemStack itemInHand) PlayerBucketFillEvent
(Player who, Block blockClicked, BlockFace blockFace, Material bucket, ItemStack itemInHand) PlayerInteractEvent
(Player who, Action action, ItemStack item, Block clickedBlock, BlockFace clickedFace) PlayerInteractEvent
(Player who, Action action, ItemStack item, Block clickedBlock, BlockFace clickedFace, EquipmentSlot hand) PlayerItemBreakEvent
(Player player, ItemStack brokenItem) PlayerItemConsumeEvent
(Player player, ItemStack item) PlayerItemMendEvent
(Player who, ItemStack item, ExperienceOrb experienceOrb, int repairAmount) PlayerSwapHandItemsEvent
(Player player, ItemStack mainHandItem, ItemStack offHandItem) -
org.bukkit.inventory中ItemStack的使用
修饰符和类型方法说明ItemStack.clone()
static ItemStack
ItemStack.deserialize
(Map<String, Object> args) 实现配置序列化与反序列化需要的方法.HorseInventory.getArmor()
获取马所装备的盔甲.EntityEquipment.getArmorContents()
获得实体当前所有穿着盔甲的拷贝PlayerInventory.getArmorContents()
获取装备槽内的全部物品.EntityEquipment.getBoots()
获取该实体当前正在穿戴的鞋子的拷贝PlayerInventory.getBoots()
返回靴子槽内的物品.EntityEquipment.getChestplate()
获取该实体当前正在穿戴的胸甲的拷贝PlayerInventory.getChestplate()
返回胸甲槽内的物品.Inventory.getContents()
返回这个物品栏内的所有物品堆.final ItemStack
InventoryView.getCursor()
Get the item on the cursor of one of the viewing players.LlamaInventory.getDecor()
得到羊驼背包中装饰槽的物品, 通常是毛毯.PlayerInventory.getExtraContents()
获取存储在此背包的所有额外物品.BrewerInventory.getFuel()
获取当前用来酿造的燃料.FurnaceInventory.getFuel()
获取当前熔炉的燃料物品.EntityEquipment.getHelmet()
获取该实体当前正在佩戴的头盔的拷贝PlayerInventory.getHelmet()
返回头盔槽内的物品.BrewerInventory.getIngredient()
获取当前酿造台的原料.FurnaceRecipe.getInput()
获取该冶炼配方的冶炼原料.BeaconInventory.getItem()
返回信标内的物品.EnchantingInventory.getItem()
获取将被附魔的物品.Inventory.getItem
(int index) 返回在指定索引的物品堆.InventoryView.getItem
(int slot) Gets one item in this inventory view by its raw slot ID.EntityEquipment.getItemInHand()
已过时。现在实体可以双持, 所以需要特定的方法来获取指定的手PlayerInventory.getItemInHand()
已过时。players can duel wield now use the methods for the specific hand insteadEntityEquipment.getItemInMainHand()
获取实体当前主手中手持的物品的拷贝PlayerInventory.getItemInMainHand()
获得玩家握在主手的物品(的副本).EntityEquipment.getItemInOffHand()
获取实体当前副手中手持的物品的拷贝PlayerInventory.getItemInOffHand()
获取玩家握在副手的物品(的副本).EntityEquipment.getLeggings()
获取该实体当前正在穿戴的护腿的拷贝PlayerInventory.getLeggings()
返回护腿槽内的物品.CraftingInventory.getMatrix()
获取合成公式.CraftingInventory.getResult()
获取合成台产生的合成品.FurnaceInventory.getResult()
获取当前熔炉生成的的物品.FurnaceRecipe.getResult()
获取该冶炼配方的冶炼生成物.MerchantRecipe.getResult()
Recipe.getResult()
得到这个配方的结果.ShapedRecipe.getResult()
Get the result.ShapelessRecipe.getResult()
Get the result of this recipe.AbstractHorseInventory.getSaddle()
获取马所装备的马鞍.EnchantingInventory.getSecondary()
获取将被用于附魔的第二物品(如青金石).FurnaceInventory.getSmelting()
获取当前熔炉的被冶炼的物品.Inventory.getStorageContents()
返回.大部分情况下本方法返回的内容代表整个物品栏, 但某些情况下返回的内容可能不包括盔甲或格子.修饰符和类型方法说明在物品栏存放所给的物品堆.本方法将尽可能完美地尝试填充已有的但还未达到堆叠上限的物品堆 和空格子.Inventory.all
(int materialId) 已过时。Magic value查找在物品栏内的包含指定物品堆的所有格子与物品堆.只有 物品堆的数目和种类都相同时才会匹配.查找在物品栏内的包含指定物品的所有格子与物品堆.ShapelessRecipe.getIngredientList()
Get the list of ingredients used for this recipe.ShapedRecipe.getIngredientMap()
Get a copy of the ingredients map.MerchantRecipe.getIngredients()
Inventory.iterator()
Inventory.iterator
(int index) 返回一个从指定索引开始的迭代器.Inventory.removeItem
(ItemStack... items) 移除在物品栏内的指定物品堆.修饰符和类型方法说明void
MerchantRecipe.addIngredient
(ItemStack item) 在物品栏存放所给的物品堆.本方法将尽可能完美地尝试填充已有的但还未达到堆叠上限的物品堆 和空格子.查找在物品栏内的包含指定物品堆的所有格子与物品堆.只有 物品堆的数目和种类都相同时才会匹配.返回一个适用于给定的ItemStack的ItemMetaboolean
检测这个物品栏是否含有与给定的物品堆匹配的物品堆.boolean
检测物品栏是否含有一定数量的完全匹配的物品堆.boolean
Inventory.containsAtLeast
(ItemStack item, int amount) 检测物品栏是否含有与所给物品堆匹配的并数量足够的物品堆.int
查找包含此物品堆的第一个格子。boolean
ItemFactory.isApplicable
(ItemMeta meta, ItemStack stack) 该方法用于检查元数据是否能够适用于指定的ItemStack上(如果适用则物品不会丢失之前的数据).boolean
该方法与equals方法相同, 但不考虑堆叠数量.void
移除在此物品栏内与给定物品堆匹配的所有物品堆.Inventory.removeItem
(ItemStack... items) 移除在物品栏内的指定物品堆.void
为这匹马装备盔甲.void
EntityEquipment.setArmorContents
(ItemStack[] items) 将实体所穿戴的盔甲设置为提供的ItemStacks数组void
PlayerInventory.setArmorContents
(ItemStack[] items) 设置装备槽的全部物品.void
设置该实体当前正在穿戴的鞋子void
设置靴子物品栏内的物品.void
EntityEquipment.setChestplate
(ItemStack chestplate) 设置该实体当前正在穿戴的胸甲void
PlayerInventory.setChestplate
(ItemStack chestplate) 设置胸甲物品栏内的物品.void
Inventory.setContents
(ItemStack[] items) 完全地覆盖物品栏的内容.移除所有存在的内容并替换为指定的物品堆.final void
Sets the item on the cursor of one of the viewing players.void
设置羊驼背包中装饰槽的物品.void
PlayerInventory.setExtraContents
(ItemStack[] items) 将给定的物品放在额外物品槽内.void
设置当前用来酿造的燃料.一般只有Material.BLAZE_POWDER
将使用此方法.void
设置当前熔炉的燃料物品.void
设置该实体当前正在佩戴的头盔void
设置头盔物品栏内的物品.void
BrewerInventory.setIngredient
(ItemStack ingredient) 设置当前酿造台的原料成分.void
设置信标内的物品.void
设置将被附魔的物品.void
在物品栏指定索引存放物品堆.void
Sets one item in this inventory view by its raw slot ID.void
把物品放在背包的指定位置.void
EntityEquipment.setItemInHand
(ItemStack stack) 已过时。现在实体可以双持, 所以需要特定的方法来获取指定的手void
PlayerInventory.setItemInHand
(ItemStack stack) 已过时。players can duel wield now use the methods for the specific hand insteadvoid
EntityEquipment.setItemInMainHand
(ItemStack item) 设置实体在主手中手持的物品void
PlayerInventory.setItemInMainHand
(ItemStack item) 设置玩家握在主手的物品.void
EntityEquipment.setItemInOffHand
(ItemStack item) 设置实体在副手中手持的物品void
PlayerInventory.setItemInOffHand
(ItemStack item) 设置玩家握在副手的物品.void
EntityEquipment.setLeggings
(ItemStack leggings) 设置该实体当前正在穿戴的护腿void
PlayerInventory.setLeggings
(ItemStack leggings) 设置护腿物品栏内的物品.void
Replace the contents of the crafting matrixvoid
设置最终合成品.void
设置当前熔炉的生成物.void
为这匹马装备一个马鞍.void
EnchantingInventory.setSecondary
(ItemStack item) 设置将被用于附魔的第二物品(如青金石).void
FurnaceInventory.setSmelting
(ItemStack stack) 设置当前熔炉的被冶炼物物品.void
Inventory.setStorageContents
(ItemStack[] items) 放置所给的物品堆至物品栏.限定符构造器说明FurnaceRecipe
(ItemStack result, Material source) 创建一个熔炉冶炼配方.FurnaceRecipe
(ItemStack result, MaterialData source) 创建一个熔炉冶炼配方.FurnaceRecipe
(ItemStack result, MaterialData source, float experience) 创建一个熔炉冶炼配方.FurnaceRecipe
(ItemStack result, Material source, int data) 已过时。不安全的参数FurnaceRecipe
(ItemStack result, Material source, int data, float experience) 已过时。不安全的参数构造一个指定物品堆的副本.MerchantRecipe
(ItemStack result, int maxUses) MerchantRecipe
(ItemStack result, int uses, int maxUses, boolean experienceReward) ShapedRecipe
(ItemStack result) 已过时。ShapedRecipe
(NamespacedKey key, ItemStack result) Create a shaped recipe to craft the specified ItemStack.ShapelessRecipe
(ItemStack result) 已过时。ShapelessRecipe
(NamespacedKey key, ItemStack result) Create a shapeless recipe to craft the specified ItemStack. -
org.bukkit.material中ItemStack的使用
修饰符和类型方法说明MaterialData.toItemStack()
已过时。这个方法创建一个大小为0的物品堆,通常没有用.MaterialData.toItemStack
(int amount) 基于这个MaterialData创建一个新的ItemStack. -
org.bukkit.potion中ItemStack的使用
修饰符和类型方法说明Potion.toItemStack
(int amount) 已过时。Converts this potion to anItemStack
with the specified amount and a correct damage value.
PlayerInventory
中更明确的方法