# 接口的使用
org.bukkit.inventory.InventoryView

使用InventoryView的程序包
程序包
说明
org.bukkit.entity
为在`世界`内存在的非三维像素单位(实体)提供的接口，包含玩家、怪物、抛射物等.
org.bukkit.event.enchantment
与`附魔台`操作相关的`事件`.
org.bukkit.event.inventory
与`物品栏`操作相关的`事件`.

- ## org.bukkit.entity中InventoryView的使用

  返回InventoryView的org.bukkit.entity中的方法
  修饰符和类型
  方法
  说明
  `@NotNull InventoryView`
  HumanEntity.`getOpenInventory()`
  获取玩家正在查看的物品栏.
  `@Nullable InventoryView`
  HumanEntity.`openEnchanting(@Nullable Location location, boolean force)`
  打开一个空白附魔台物品栏界面, 玩家物品栏(背包)在底部.
  `@Nullable InventoryView`
  HumanEntity.`openInventory(@NotNull Inventory inventory)`
  打开一个物品栏, 窗口顶部为你指定的物品栏, 底部为玩家物品栏(背包).
  `@Nullable InventoryView`
  HumanEntity.`openMerchant(@NotNull Villager trader, boolean force)`
  与某村民开始交易.
  `@Nullable InventoryView`
  HumanEntity.`openMerchant(@NotNull Merchant merchant, boolean force)`
  与某商人开始交易.
  `@Nullable InventoryView`
  HumanEntity.`openWorkbench(@Nullable Location location, boolean force)`
  打开一个空白工作台物品栏界面, 玩家物品栏(背包)在底部.
  参数类型为InventoryView的org.bukkit.entity中的方法
  修饰符和类型
  方法
  说明
  `void`
  HumanEntity.`openInventory(@NotNull InventoryView inventory)`
  打开指定的物品栏.

- ## org.bukkit.event.enchantment中InventoryView的使用

  参数类型为InventoryView的org.bukkit.event.enchantment中的构造器
  限定符
  构造器
  说明
  ``
  `EnchantItemEvent(@NotNull Player enchanter, @NotNull InventoryView view, @NotNull Block table, @NotNull ItemStack item, int level, @NotNull Map<Enchantment,Integer> enchants, @NotNull Enchantment enchantmentHint, int levelHint, int i)`
  ``
  `PrepareItemEnchantEvent(@NotNull Player enchanter, @NotNull InventoryView view, @NotNull Block table, @NotNull ItemStack item, @NotNull EnchantmentOffer[] offers, int bonus)`

- ## org.bukkit.event.inventory中InventoryView的使用

  声明为InventoryView的org.bukkit.event.inventory中的字段
  修饰符和类型
  字段
  说明
  `protected InventoryView`
  InventoryEvent.`transaction`
  返回InventoryView的org.bukkit.event.inventory中的方法
  修饰符和类型
  方法
  说明
  `@NotNull InventoryView`
  InventoryEvent.`getView()`
  获取物品栏本身的 InventoryView 对象。
  参数类型为InventoryView的org.bukkit.event.inventory中的构造器
  限定符
  构造器
  说明
  ``
  `CraftItemEvent(@NotNull Recipe recipe, @NotNull InventoryView what, @NotNull InventoryType.SlotType type, int slot, @NotNull ClickType click, @NotNull InventoryAction action)`
  ``
  `CraftItemEvent(@NotNull Recipe recipe, @NotNull InventoryView what, @NotNull InventoryType.SlotType type, int slot, @NotNull ClickType click, @NotNull InventoryAction action, int key)`
  ``
  `InventoryClickEvent(@NotNull InventoryView view, @NotNull InventoryType.SlotType type, int slot, @NotNull ClickType click, @NotNull InventoryAction action)`
  ``
  `InventoryClickEvent(@NotNull InventoryView view, @NotNull InventoryType.SlotType type, int slot, @NotNull ClickType click, @NotNull InventoryAction action, int key)`
  ``
  `InventoryCloseEvent(@NotNull InventoryView transaction)`
  ``
  `InventoryCreativeEvent(@NotNull InventoryView what, @NotNull InventoryType.SlotType type, int slot, @NotNull ItemStack newItem)`
  ``
  `InventoryDragEvent(@NotNull InventoryView what, @Nullable ItemStack newCursor, @NotNull ItemStack oldCursor, boolean right, @NotNull Map<Integer,ItemStack> slots)`
  ``
  `InventoryEvent(@NotNull InventoryView transaction)`
  ``
  `InventoryInteractEvent(@NotNull InventoryView transaction)`
  ``
  `InventoryOpenEvent(@NotNull InventoryView transaction)`
  ``
  `PrepareAnvilEvent(@NotNull InventoryView inventory, @Nullable ItemStack result)`
  ``
  `PrepareGrindstoneEvent(@NotNull InventoryView inventory, @Nullable ItemStack result)`
  ``
  `PrepareInventoryResultEvent(@NotNull InventoryView inventory, @Nullable ItemStack result)`
  ``
  `PrepareItemCraftEvent(@NotNull CraftingInventory what, @NotNull InventoryView view, boolean isRepair)`
  ``
  `PrepareSmithingEvent(@NotNull InventoryView inventory, @Nullable ItemStack result)`
  ``
  `SmithItemEvent(@NotNull InventoryView view, InventoryType.SlotType type, int slot, @NotNull ClickType click, @NotNull InventoryAction action)`
  ``
  `SmithItemEvent(@NotNull InventoryView view, InventoryType.SlotType type, int slot, @NotNull ClickType click, @NotNull InventoryAction action, int key)`
  ``
  `TradeSelectEvent(@NotNull InventoryView transaction, int newIndex)`