1.16.1 Mimic Player Inventory GUI

Discussion in 'Spigot Plugin Development' started by Th3_DoC, Jun 30, 2020.

  1. Is it possible to mimic the Player GUI you see with armour slots etc. When viewing another player inventory?
  2. TheViperShow

    TheViperShow Previously FendiTony777

    No, if I remember that inventory type is client-only.
  3. You can open other players inventories (it will look like you are opening a chest), but you can't see the players armor slots.

    You could, however, create a custom GUI where you get the armor stand slots of the target player and put it into that GUI. (similar to the way Hypixel does it in Skyblock when you right click a player)
    #3 CodingCookie8, Jun 30, 2020
    Last edited: Jun 30, 2020
    • Like Like x 1
    • Agree Agree x 1
  4. @FendiTony777 i thought so I couldn’t remember.

    @CodingCookie8 my only problem when doing so is when we edit the inventory because of a world switch or a moderator removing stolen items, spigot screams at us wanting a size of 41 or less to save it. however custom guis require 9 slot increments 36/45 not 41 which is a full inventory/hot bar/armour selection.

    That said, I would think there’s a way to resize an itemstack[] after it’s been initialized by stripping the 4 slots off the end of the itemstack[] or something along those lines to achieve the 41 for saving, whilst keeping everything in its original place aside from said removed items.

    **EDITED** --- For Future Searchers

    For those looking to mimic it as close as possible setting the initial state to 45 and modifying the item stack to 41 slots before saving does the trick and places all items where they should be respectively.
    #4 Th3_DoC, Jun 30, 2020
    Last edited: Jun 30, 2020