Package net.glowstone.inventory
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 Summary
ConstructorsConstructorDescriptionGlowCraftingInventory(org.bukkit.inventory.InventoryHolder owner, org.bukkit.event.inventory.InventoryType type) Create an inventory for the 2x2 or 3x3 crafting grid. -
Method Summary
Modifier and TypeMethodDescriptionvoidcraft()Remove a layer of items from the inventory.org.bukkit.inventory.ItemStack[]intGets the number of slots in this inventory according to the protocol.org.bukkit.inventory.Recipeorg.bukkit.inventory.ItemStackvoidhandleShiftClick(GlowPlayer player, org.bukkit.inventory.InventoryView view, int clickedSlot, org.bukkit.inventory.ItemStack clickedItem) Handle a shift click in this inventory by the specified player.booleanitemShiftClickAllowed(int slot, org.bukkit.inventory.ItemStack stack) Check whether, in a shift-click operation, an item of the specified type may be placed in the given slot.voidsetItem(int index, org.bukkit.inventory.ItemStack item) voidsetMatrix(org.bukkit.inventory.ItemStack[] contents) voidsetResult(org.bukkit.inventory.ItemStack newResult) voidUpdate the result slot with the current matrix.Methods inherited from class net.glowstone.inventory.GlowInventory
addItem, addItemStack, addViewer, all, all, clear, clear, close, consumeItem, consumeItem, contains, contains, contains, contains, containsAtLeast, first, first, firstEmpty, getContents, getHolder, getHolder, getItem, getLocation, getMaxStackSize, getSize, getSlot, getSlots, getSlotType, getStorageContents, getTitle, getType, getViewers, getViewersSet, initialize, isEmpty, itemPlaceAllowed, iterator, iterator, remove, remove, removeItem, removeItemAnySlot, removeItemStack, removeViewer, setContents, setMaxStackSize, setStorageContents, setTitle, toString, tryToFillSlotsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.bukkit.inventory.Inventory
addItem, all, all, clear, clear, close, contains, contains, contains, contains, containsAtLeast, first, first, firstEmpty, getContents, getHolder, getHolder, getItem, getLocation, getMaxStackSize, getSize, getStorageContents, getType, getViewers, isEmpty, iterator, iterator, remove, remove, removeItem, removeItemAnySlot, setContents, setMaxStackSize, setStorageContentsMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
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 playertype-InventoryType.CRAFTINGorInventoryType.WORKBENCH
-
-
Method Details
-
setItem
public void setItem(int index, org.bukkit.inventory.ItemStack item) - Specified by:
setItemin interfaceorg.bukkit.inventory.Inventory- Overrides:
setItemin classGlowInventory
-
itemShiftClickAllowed
public boolean itemShiftClickAllowed(int slot, org.bukkit.inventory.ItemStack stack) Description copied from class:GlowInventoryCheck whether, in a shift-click operation, an item of the specified type may be placed in the given slot.- Overrides:
itemShiftClickAllowedin classGlowInventory- 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:GlowInventoryHandle 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:
handleShiftClickin classGlowInventory- Parameters:
player- The player who clickedview- The inventory view in which was clickedclickedSlot- The slot in the viewclickedItem- The item at which was clicked
-
getRawSlots
public int getRawSlots()Description copied from class:GlowInventoryGets the number of slots in this inventory according to the protocol.Some inventories have 0 slots in the protocol, despite having slots.
- Overrides:
getRawSlotsin classGlowInventory- 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:
getResultin interfaceorg.bukkit.inventory.CraftingInventory
-
setResult
public void setResult(org.bukkit.inventory.ItemStack newResult) - Specified by:
setResultin interfaceorg.bukkit.inventory.CraftingInventory
-
getMatrix
public org.bukkit.inventory.ItemStack[] getMatrix()- Specified by:
getMatrixin interfaceorg.bukkit.inventory.CraftingInventory
-
setMatrix
public void setMatrix(org.bukkit.inventory.ItemStack[] contents) - Specified by:
setMatrixin interfaceorg.bukkit.inventory.CraftingInventory
-
getRecipe
public org.bukkit.inventory.Recipe getRecipe()- Specified by:
getRecipein interfaceorg.bukkit.inventory.CraftingInventory
-
updateResultSlot
public void updateResultSlot()Update the result slot with the current matrix.
-