Inventory

Discussion in 'Spigot Plugin Development' started by DidactCraft, May 25, 2015.

  1. Hey, So I've been trying to figure this out for about 30 minutes now, but its best to come to the amazing spigot community for help.

    Ok so I have made a inventory which has 3 rows, and i want to store items in the first slot of each row. Like row 1, column 2. What's the code for that? I can set the item to be in the first 9 slots but how do I make it so the item is within the 2nd line but first slot!

    Thanks in advance! (I'm a new developer, so pl0x no hate) <3
     
  2. The slot numbers simply continue. So, if each row has 9 items (index 0-8), item number 10 (index 9) is the first item of the second row.
     
  3. No. Inventory slots begin at 0 at the first slot of a row, and end at 8 at the last slot of the first row. So, the beginning of the second row is 9, and the end 17.

    Setting items:
    Code (Java):
    yourInventory.setItem(slot, itemstack);
     
  4. X X X X X X X X X

    0 1 2 3 4 5 6 7 8
    9 10 etc
     
  5. Yes, in code it is. I was speaking about the principle in general. But I see how that's unneccessarily confusing, so I've edited my post too.
     
  6. Thankyou! All working now <3
     
  7. If you need more help, check this resource out: https://bukkit.org/threads/tutorial-create-a-inventory-menu.173571/