Return to site

Inventory Slot Id Minecraft

broken image


Minecraft displays the player inventory differently, according to how the window was opened. Ranges of slot indices vary in meaning between different 'windows'. The Open Window packet indicates which window is being opened according to:

  • 2Chest
Window Type Description
minecraft:container Fallback for unknown types; also used for Ender chests. Behaves the same as minecraft:chest.
minecraft:chestChest, large chest, or minecart with chest
minecraft:crafting_tableCrafting table
minecraft:furnaceFurnace
minecraft:dispenserDispenser
minecraft:enchanting_tableEnchantment table
minecraft:brewing_standBrewing stand
minecraft:villagerVillager
minecraft:beaconBeacon
minecraft:anvilAnvil
minecraft:hopperHopper or minecart with hopper
minecraft:dropperDropper
minecraft:shulker_boxShulker box
EntityHorseHorse, donkey, mule or Llama
  • The inventory consists of 4 armor slots, 27 storage slots, and 9 hotkey slots (this group of slots is sometimes called the 'Hotbar' or 'quick-access bar'). Items in the hotkey slots can be selected during gameplay using the keyboard (keys 1-9) or mouse wheel, placed, or wielded with the mouse buttons on PC.
  • Information about the Crafting Table block from Minecraft, including its item ID, spawn commands, crafting recipe and more. Crafting tables are one of the most important items in Minecraft. They are used for most crafting recipes as the inventory crafting square is only 2x2.
  • Skript Version: 2.2-dev25 Minecraft Version: 1.10.2 Hey! I'm trying to make a skript where if a player clicks on the slot '2' in his/her's inventory.

The slot number is calculated starting at 0, counting up through the window's unique slots, and then counting through the players inventory.

Jun 26, 2016 Home Minecraft Mods Advanced Inventory Mod for Minecraft 1.10.2/1.9/1.7.10. Is really easy to craft all you have to do is just to set the recipe in the crafter settings and keep that slot stocked with the necessary items, that you must click on the item you want them will auto-craft for you.

For all windows, the slot in the upper-left corner of the player's inventory is slot n where n is the number of unique slots, and slot number -999 is always used for clicking outside the window.

The number of unique slots in the window is sent in the Open Window (Play, 0x2d, clientbound) packet for all storage windows (e.g. Chest, Dropper). For non-storage windows (the items get dropped when the window is closed, e.g. Workbench, Anvil), the received number of unique slots is always 0, but it can be looked up by the client from the window type.

The default inventory window, which is never explicitly opened by the server, has 10 unique slots.

Inventory slot id minecraft

Rectangular regions are always indexed starting with the upper-left corner and scanning across rows. If a window has a crafting region, the output slot is always slot 0 followed immediately by the input region.

Each window type is described in the following sections. All slot index ranges are inclusive and reflect the indices observed in the Minecraft protocol.

For the window properties (additional data in each window, e.g. smelting progress or enchantments), refer to the table in the Window Property packet.

Using -1 as slot index and as window id will set the cursor item (the stack dragged with the mouse).

Player Inventory

Inventory slots

This is the inventory window that the player can always open, typically by pressing E since Beta 1.4. Before, you had to press I.

Slot range Description
0 crafting output
1–4 2×2 crafting input (1 + x + 2 * y)
5–8 armor (head, chest, legs, feet)
9–35 main inventory
36–44 hotbar
45 Offhand slot

Note that this is different from inventory items stored in a player.dat file. This may help: https://gist.github.com/459a1691c3dd751db160

Chest

Chest slots

This is the window that is opened when the player right-clicks on a single chest block.

Slot range Description
0–26 chest
27–53 main inventory
54–62 hotbar
Double/large chest slots

Large chest

This is the window that is opened when the player right-clicks on a double chest block (two adjacent chest blocks).

Slot range Description
0–53 chest
54–80 main inventory
81–89 hotbar

It is possible to receive different 'Number Of Slots' parameters than those two. In vanilla, using /setblock four times around a chest and then opening the middle chest will open a window with 5*27 chest slots. Some custom servers will send chest inventories with other sizes, usually ranging from 1 row to 6 rows. These may be used for custom GUIs. It is thus important to correctly use the 'Number Of Slots' parameter in the open window packet to determine the number of rows in the chest, rather than hardcoding what constitutes a regular chest or a large chest.

Crafting table

Crafting table slots

This is the window that is opened when the player right-clicks on a workbench.

Slot range Description
0 crafting output
1–9 3×3 crafting input (1 + x + 3 * y)
10–36 main inventory
37–45 hotbar

If the 'Number Of Slots' parameter is not set to 0, the opened window will behave like a container window.

Furnace

Furnace slots

The window that appears when a furnace is right-clicked.

Slot range Description
0 ingredient
1 fuel
2 output
3–29 main inventory
30–38 hotbar

Cheap zynga poker chips for facebook. If the 'Number Of Slots' parameter is inferior to 3, placing an item in a slot may crash the client.

Dispenser

Dispenser/dropper slots

The inventory that appears when a dispenser or dropper is opened.

Slot range Description
0–8 3×3 dispenser contents (x + 3 * y)
9–35 main inventory
36-44 hotbar

If the 'Number Of Slots' parameter is inferior to 9, placing an item in a slot may crash the client.

Minecraft

Enchantment Table

Enchantment table slots

The inventory of an enchantment table. The enchant buttons trigger a Enchant item packet.

Inventory Slot Id Minecraft
Slot range Description
0 item to enchant
1 lapis lazuli slot
2–28 main inventory
29–37 hotbar

Brewing stand

Brewing stand slots

The GUI that appears when a brewing stand is opened.

Slot range Description
0-2 bottles/potions
3 potion ingredient
4 blaze powder
5-31 main inventory
32-40 hotbar

Villager trading

Villeger slots

The GUI that appears when a villager is right-clicked. Note that if the villager only requires one item, you can put it in either (or both) slots.

Slot range Description
0-1 input items
2 result
3–29 main inventory
30–38 hotbar

Beacon

Beacon slots

The window that appears when a beacon is right-clicked.

Slot range Description
0 payment item
1–27 main inventory
28–36 hotbar

Anvil

Anvil slots
Slot range Description
0 first item
1 second item
2 result
3–29 main inventory
30–38 hotbar

Hopper

Hopper slots

The window that appears when a hopper or hopper minecart is opened.

Slot range Description
0-4 hopper slots
5–31 main inventory
32–40 hotbar

Shulker box

Shulker box slots

This is the window that is opened when the player right-clicks on a shulker box chest.

Slot range Description
0–26 box slots
27–53 main inventory
54–62 hotbar

Llama

Llama slots

The inventory that appears when a tamed llama is right-clicked and has a chest, or when the player's inventory is opened while riding a tamed llama. Depending on the value of the strength field, the number of chest rows may vary (max is 5, so 15 slots).

There still is a saddle slot, even though it cannot be used and is invisible.

Slot positions within the llama inventory vary - slot 2 may be at (1,0) or at (0,1) depending on the number of columns.

Slot range Description
0 saddle
1 carpet
2-(2+3*Strength) llama inventory
(2+3*Strength)+1-(2+3*Strength)+27 player inventory
(2+3*Strength)+28-(2+3*Strength)+35 hotbar
  • Unchested llama

  • Llama with strength 1

  • Llama with strength 2

  • Llama with strength 3

  • Llama with strength 4

  • Llama with strength 5

Horse

Horse slots

The window for when a tamed horse is right-clicked or the player's inventory is opened while riding a horse.

Minecraft
Slot range Description
0 saddle
1 armor
2–28 main inventory
29–37 hotbar

Inventory Slot Id Minecraft 1.7.10

  • Horse slots

  • Skeleton horse slots

  • Zombie horse slots

Donkey

Donkey slots

The inventory that appears when a tamed donkey (or mule?) is right-clicked, or when the player's inventory is opened while riding a tamed donkey or mule.

Inventory Slot Id Minecraft 1.12.2

Minecraft

Rectangular regions are always indexed starting with the upper-left corner and scanning across rows. If a window has a crafting region, the output slot is always slot 0 followed immediately by the input region.

Each window type is described in the following sections. All slot index ranges are inclusive and reflect the indices observed in the Minecraft protocol.

For the window properties (additional data in each window, e.g. smelting progress or enchantments), refer to the table in the Window Property packet.

Using -1 as slot index and as window id will set the cursor item (the stack dragged with the mouse).

Player Inventory

Inventory slots

This is the inventory window that the player can always open, typically by pressing E since Beta 1.4. Before, you had to press I.

Slot range Description
0 crafting output
1–4 2×2 crafting input (1 + x + 2 * y)
5–8 armor (head, chest, legs, feet)
9–35 main inventory
36–44 hotbar
45 Offhand slot

Note that this is different from inventory items stored in a player.dat file. This may help: https://gist.github.com/459a1691c3dd751db160

Chest

Chest slots

This is the window that is opened when the player right-clicks on a single chest block.

Slot range Description
0–26 chest
27–53 main inventory
54–62 hotbar
Double/large chest slots

Large chest

This is the window that is opened when the player right-clicks on a double chest block (two adjacent chest blocks).

Slot range Description
0–53 chest
54–80 main inventory
81–89 hotbar

It is possible to receive different 'Number Of Slots' parameters than those two. In vanilla, using /setblock four times around a chest and then opening the middle chest will open a window with 5*27 chest slots. Some custom servers will send chest inventories with other sizes, usually ranging from 1 row to 6 rows. These may be used for custom GUIs. It is thus important to correctly use the 'Number Of Slots' parameter in the open window packet to determine the number of rows in the chest, rather than hardcoding what constitutes a regular chest or a large chest.

Crafting table

Crafting table slots

This is the window that is opened when the player right-clicks on a workbench.

Slot range Description
0 crafting output
1–9 3×3 crafting input (1 + x + 3 * y)
10–36 main inventory
37–45 hotbar

If the 'Number Of Slots' parameter is not set to 0, the opened window will behave like a container window.

Furnace

Furnace slots

The window that appears when a furnace is right-clicked.

Slot range Description
0 ingredient
1 fuel
2 output
3–29 main inventory
30–38 hotbar

Cheap zynga poker chips for facebook. If the 'Number Of Slots' parameter is inferior to 3, placing an item in a slot may crash the client.

Dispenser

Dispenser/dropper slots

The inventory that appears when a dispenser or dropper is opened.

Slot range Description
0–8 3×3 dispenser contents (x + 3 * y)
9–35 main inventory
36-44 hotbar

If the 'Number Of Slots' parameter is inferior to 9, placing an item in a slot may crash the client.

Enchantment Table

Enchantment table slots

The inventory of an enchantment table. The enchant buttons trigger a Enchant item packet.

Slot range Description
0 item to enchant
1 lapis lazuli slot
2–28 main inventory
29–37 hotbar

Brewing stand

Brewing stand slots

The GUI that appears when a brewing stand is opened.

Slot range Description
0-2 bottles/potions
3 potion ingredient
4 blaze powder
5-31 main inventory
32-40 hotbar

Villager trading

Villeger slots

The GUI that appears when a villager is right-clicked. Note that if the villager only requires one item, you can put it in either (or both) slots.

Slot range Description
0-1 input items
2 result
3–29 main inventory
30–38 hotbar

Beacon

Beacon slots

The window that appears when a beacon is right-clicked.

Slot range Description
0 payment item
1–27 main inventory
28–36 hotbar

Anvil

Anvil slots
Slot range Description
0 first item
1 second item
2 result
3–29 main inventory
30–38 hotbar

Hopper

Hopper slots

The window that appears when a hopper or hopper minecart is opened.

Slot range Description
0-4 hopper slots
5–31 main inventory
32–40 hotbar

Shulker box

Shulker box slots

This is the window that is opened when the player right-clicks on a shulker box chest.

Slot range Description
0–26 box slots
27–53 main inventory
54–62 hotbar

Llama

Llama slots

The inventory that appears when a tamed llama is right-clicked and has a chest, or when the player's inventory is opened while riding a tamed llama. Depending on the value of the strength field, the number of chest rows may vary (max is 5, so 15 slots).

There still is a saddle slot, even though it cannot be used and is invisible.

Slot positions within the llama inventory vary - slot 2 may be at (1,0) or at (0,1) depending on the number of columns.

Slot range Description
0 saddle
1 carpet
2-(2+3*Strength) llama inventory
(2+3*Strength)+1-(2+3*Strength)+27 player inventory
(2+3*Strength)+28-(2+3*Strength)+35 hotbar
  • Unchested llama

  • Llama with strength 1

  • Llama with strength 2

  • Llama with strength 3

  • Llama with strength 4

  • Llama with strength 5

Horse

Horse slots

The window for when a tamed horse is right-clicked or the player's inventory is opened while riding a horse.

Slot range Description
0 saddle
1 armor
2–28 main inventory
29–37 hotbar

Inventory Slot Id Minecraft 1.7.10

  • Horse slots

  • Skeleton horse slots

  • Zombie horse slots

Donkey

Donkey slots

The inventory that appears when a tamed donkey (or mule?) is right-clicked, or when the player's inventory is opened while riding a tamed donkey or mule.

Inventory Slot Id Minecraft 1.12.2

There still is an armor slot, even though it cannot be used and is invisible.

Slot range Description
0 saddle
1 armor
2–16 donkey inventory
17–43 (2-28 if unchested) player inventory
44–52 (29-37 if unchested) hotbar
  • Unchested donkey

  • Chested donkey

  • Unchested mule

  • Chested mule

Retrieved from 'http://wiki.vg/index.php?title=Inventory&oldid=14093'

Component name:inventory_controller

This component is provided by the inventory controller upgrade.

With this API the robot can receive additional information about items or inventories and is able to put items into and take them from specific slots. How to do brick slots sbc.

Sides required for most operations are specified in the Sides API. If no or an invalid side is provided functions will usually throw an error. To interact with the robot's own inventory you need to use the side back, which however makes it impossible to interact with inventories behind the robot. Robots cannot access their left or right sides. You can interact with external inventories in front of, above, or below the robot.

Callbacks:

  • getInventorySize(side: number): number or nil[, string]
    Returns the size of the inventory at the specified side.side - must be a valid side.
    Returns: the size of the inventory, or nil followed by a description why this function failed (usually no inventory).
  • getStackInSlot(side:number, slot:number):table
    Returns a table describing the item in the specified slot or nil. Deprecated for getting info about robot's own inventory, see getStackInInternalSlot.
    side - must be a valid side.
    slot - the slot to analyze. This does not check the inventory size and will consider slots outside the inventory bounds to be empty.
    Returns:nil if the slot was empty (or outside the inventory's bounds), a table otherwise with the following information about the item in that slot:
    • damage:number - the current damage value of the item.
    • maxDamage:number - the maximum damage this item can have before it breaks.
    • maxSize:number - the maximum stack size of this item.
    • id:number - the Minecraft id of the item. Note that this field is only included if insertIdsInConverters=true in the configs, and can vary between servers!
    • name:string - the untranslated item name, which is an internal Minecraft value like oc:item.FloppyDisk
    • hasTag:boolean - whether or not the item has an NBT tag associated with it.
  • getStackInInternalSlot(slot:number):table
    Gets Itemstack description of item in specified or selected slot (if no input provided) of robot inventory.
  • dropIntoSlot(side:number, slot:number[, count:number]):boolean[, string]
    Puts up to count items from the currently selected slot into the specified slot of the inventory at the specified side.
    side - a valid side.
    slot - the slot to drop the item into.
    count - how many items to transfer.
    Returns:true if at least one item was moved, false and a secondary result that describes the error otherwise.
    Note that the robot cannot drop items into it's own inventory, attempting to do so will cause this to throw an error. You need to use robot.transferTo from the Robot API to do so.
  • suckFromSlot(side:number, slot:number[, count:number]):boolean
    Takes up to count items from the specified slot of the inventory at the specified side and puts them into the currently selected slot.
    side - a valid side.
    slot - the slot to take the item from.
    count - how many items to transfer.
    Returns:true if at least one item was moved, false otherwise.
    If the currently selected slot is occupied, then the items will be stacked with similar items in the robot's inventory or moved to the next free slot if available. If no slot is available this operation will fail.
    Note that the robot cannot suck items from it's own inventory, attempting to do so will cause this to throw an error. You need to use robot.transferTo from the Robot API to do so.
  • equip():boolean
    Swaps the content of the robot's tool slot with the content of the currently selected inventory slot.
    Returns:true if the items were swapped, false otherwise. This operation usually succeeds.
    Note that you can put any kind of item into the robot's tool slot, not only tools, even items that the robot cannot use at all.
  • store(side:number, slot:number, dbAddress:string, dbSlot:number):boolean
    Stores the Itemstack description of the item from the specified slot in an inventory on the specified side, into a specified database slot with the specified address.
  • storeInternal(slot:number, dbAddress:string, dBslot:number):boolean
    Stores Itemstack description of item in specified robot inventory slot into specified database slot with the specified database address.
  • compareToDatabase(slot:number, dBaddress:string, dBslot:number):boolean
    Compare Itemstack description in specified slot with one in specified slot of a database with specified address. Returns true if items match.
  • compareStacks(side:number, slotA:number, slotB:number):boolean
    Checks to see if Itemstack descriptions in specified slotA and slotB of inventory on specified side match. Returns true if identical.
  • getSlotMaxStackSize(side:number, slot:number):number
    Gets maximum number of items in specified slot in inventory on the specified side.
  • getSlotStackSize(side:number, slot:number):number
    Gets number of items in specified slot in inventory on the specified side.

Example:

Print meta-info about the item in the position indicated by slot

snippet.lua




broken image