Java Code Examples for org.bukkit.event.inventory.InventoryType.SlotType#OUTSIDE
The following examples show how to use
org.bukkit.event.inventory.InventoryType.SlotType#OUTSIDE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InventoryClickEvent.java From Kettle with GNU General Public License v3.0 | 5 votes |
/** * Gets the ItemStack currently in the clicked slot. * * @return the item in the clicked */ public ItemStack getCurrentItem() { if (slot_type == SlotType.OUTSIDE) { return current; } return getView().getItem(rawSlot); }
Example 2
Source File: InventoryClickEvent.java From Kettle with GNU General Public License v3.0 | 5 votes |
/** * Sets the ItemStack currently in the clicked slot. * * @param stack the item to be placed in the current slot */ public void setCurrentItem(ItemStack stack) { if (slot_type == SlotType.OUTSIDE) { current = stack; } else { getView().setItem(rawSlot, stack); } }
Example 3
Source File: CraftInventoryView.java From Kettle with GNU General Public License v3.0 | 4 votes |
public static SlotType getSlotType(InventoryView inventory, int slot) { SlotType type = SlotType.CONTAINER; if (slot >= 0 && slot < inventory.getTopInventory().getSize()) { switch (inventory.getType()) { case FURNACE: if (slot == 2) { type = SlotType.RESULT; } else if (slot == 1) { type = SlotType.FUEL; } else { type = SlotType.CRAFTING; } break; case BREWING: if (slot == 3) { type = SlotType.FUEL; } else { type = SlotType.CRAFTING; } break; case ENCHANTING: type = SlotType.CRAFTING; break; case WORKBENCH: case CRAFTING: if (slot == 0) { type = SlotType.RESULT; } else { type = SlotType.CRAFTING; } break; case MERCHANT: if (slot == 2) { type = SlotType.RESULT; } else { type = SlotType.CRAFTING; } break; case BEACON: type = SlotType.CRAFTING; break; case ANVIL: if (slot == 2) { type = SlotType.RESULT; } else { type = SlotType.CRAFTING; } break; default: // Nothing to do, it's a CONTAINER slot } } else { if (slot == -999 || slot == -1) { type = SlotType.OUTSIDE; } else if (inventory.getType() == InventoryType.CRAFTING) { // Also includes creative inventory if (slot < 9) { type = SlotType.ARMOR; } else if (slot > 35) { type = SlotType.QUICKBAR; } } else if (slot >= (inventory.countSlots() - (9 + 4 + 1))) { // Quickbar, Armor, Offhand type = SlotType.QUICKBAR; } } return type; }
Example 4
Source File: CraftInventoryView.java From Thermos with GNU General Public License v3.0 | 4 votes |
public static SlotType getSlotType(InventoryView inventory, int slot) { SlotType type = SlotType.CONTAINER; if (inventory == null) return type; // Cauldron - modded inventories with no Bukkit wrapper if (slot >= 0 && slot < inventory.getTopInventory().getSize()) { switch(inventory.getType()) { case FURNACE: if (slot == 2) { type = SlotType.RESULT; } else if(slot == 1) { type = SlotType.FUEL; } else { type = SlotType.CRAFTING; } break; case BREWING: if (slot == 3) { type = SlotType.FUEL; } else { type = SlotType.CRAFTING; } break; case ENCHANTING: type = SlotType.CRAFTING; break; case WORKBENCH: case CRAFTING: if (slot == 0) { type = SlotType.RESULT; } else { type = SlotType.CRAFTING; } break; case MERCHANT: if (slot == 2) { type = SlotType.RESULT; } else { type = SlotType.CRAFTING; } break; case BEACON: type = SlotType.CRAFTING; break; case ANVIL: if (slot == 2) { type = SlotType.RESULT; } else { type = SlotType.CRAFTING; } break; default: // Nothing to do, it's a CONTAINER slot } } else { if (slot == -999) { type = SlotType.OUTSIDE; } else if (inventory.getType() == InventoryType.CRAFTING) { if (slot < 9) { type = SlotType.ARMOR; } else if (slot > 35) { type = SlotType.QUICKBAR; } } else if (slot >= (inventory.countSlots() - 9)) { type = SlotType.QUICKBAR; } } return type; }