Java Code Examples for org.bukkit.event.inventory.InventoryType.SlotType#QUICKBAR
The following examples show how to use
org.bukkit.event.inventory.InventoryType.SlotType#QUICKBAR .
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: 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 2
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; }