Class GlowCraftingInventory

java.lang.Object
net.glowstone.inventory.GlowInventory
net.glowstone.inventory.GlowCraftingInventory
All Implemented Interfaces:
Iterable<org.bukkit.inventory.ItemStack>, org.bukkit.inventory.CraftingInventory, org.bukkit.inventory.Inventory

public class GlowCraftingInventory extends GlowInventory implements org.bukkit.inventory.CraftingInventory
Represents a crafting grid inventory, both workbench and per-player.
  • Constructor Details

    • GlowCraftingInventory

      public GlowCraftingInventory(org.bukkit.inventory.InventoryHolder owner, org.bukkit.event.inventory.InventoryType type)
      Create an inventory for the 2x2 or 3x3 crafting grid.
      Parameters:
      owner - the crafting player
      type - InventoryType.CRAFTING or InventoryType.WORKBENCH
  • Method Details

    • setItem

      public void setItem(int index, org.bukkit.inventory.ItemStack item)
      Specified by:
      setItem in interface org.bukkit.inventory.Inventory
      Overrides:
      setItem in class GlowInventory
    • itemShiftClickAllowed

      public boolean itemShiftClickAllowed(int slot, org.bukkit.inventory.ItemStack stack)
      Description copied from class: GlowInventory
      Check whether, in a shift-click operation, an item of the specified type may be placed in the given slot.
      Overrides:
      itemShiftClickAllowed in class GlowInventory
      Parameters:
      slot - The slot number.
      stack - The stack to add.
      Returns:
      Whether the stack can be added there.
    • handleShiftClick

      public void handleShiftClick(GlowPlayer player, org.bukkit.inventory.InventoryView view, int clickedSlot, org.bukkit.inventory.ItemStack clickedItem)
      Description copied from class: GlowInventory
      Handle a shift click in this inventory by the specified player.

      The default implementation distributes items from the right to the left and from the bottom to the top.

      Overrides:
      handleShiftClick in class GlowInventory
      Parameters:
      player - The player who clicked
      view - The inventory view in which was clicked
      clickedSlot - The slot in the view
      clickedItem - The item at which was clicked
    • getRawSlots

      public int getRawSlots()
      Description copied from class: GlowInventory
      Gets the number of slots in this inventory according to the protocol.

      Some inventories have 0 slots in the protocol, despite having slots.

      Overrides:
      getRawSlots in class GlowInventory
      Returns:
      The numbers of slots
    • craft

      public void craft()
      Remove a layer of items from the inventory.
    • getResult

      public org.bukkit.inventory.ItemStack getResult()
      Specified by:
      getResult in interface org.bukkit.inventory.CraftingInventory
    • setResult

      public void setResult(org.bukkit.inventory.ItemStack newResult)
      Specified by:
      setResult in interface org.bukkit.inventory.CraftingInventory
    • getMatrix

      public org.bukkit.inventory.ItemStack[] getMatrix()
      Specified by:
      getMatrix in interface org.bukkit.inventory.CraftingInventory
    • setMatrix

      public void setMatrix(org.bukkit.inventory.ItemStack[] contents)
      Specified by:
      setMatrix in interface org.bukkit.inventory.CraftingInventory
    • getRecipe

      public org.bukkit.inventory.Recipe getRecipe()
      Specified by:
      getRecipe in interface org.bukkit.inventory.CraftingInventory
    • updateResultSlot

      public void updateResultSlot()
      Update the result slot with the current matrix.