1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Get and set selected item.

Discussion in 'Development' started by Muqsit, Feb 18, 2017.

  1. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    How do you get and set the item that a player selects from a GUI.
    Eg:
    Screenshot_2017-02-18-21-11-38.png

    How do I set the selected item to Item::AIR? (Note that the item is neither in the player's inventory nor in the chest).
     
  2. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    I want say you cant? do that?
    like change what player is selecting on the fly without them putting into their inventory first
     
  3. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    There must be a way. There has to.
     
  4. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    Blame :shoghi:
     
    Muqsit likes this.
  5. SavionLegendZzz

    SavionLegendZzz Slime

    Messages:
    75
    GitHub:
    savionlegends
    I think it might be a FloatingInventory(not so sure haven't been up to par with the new API and such)
     
  6. Redux

    Redux Spider Jockey

    Messages:
    49
    GitHub:
    reduxredstone
    There's nothing called FloatingInventory in the source. At least not currently.
     
  7. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Dktapps coded that for a spoon for storing the item in such a situation, in a virtual inventory. But since it's a virtual implementation and doesn't handle things game-specific, it isn't the answer for this thread. :/
     
  8. Junkdude

    Junkdude Zombie

    Messages:
    346
    GitHub:
    JunkDaCoder
    simpletransactionque?
     
  9. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    Using pocket GUI, that's the stuff i got:
    Code:
    [17:17:18] [Server thread/DEBUG]: [PacketLogger] object(pocketmine\network\protocol\ContainerSetSlotPacket)#11430 (8) {
      ["windowid"]=>
      int(3)
      ["slot"]=>
      int(0)
      ["hotbarSlot"]=>
      int(0)
      ["item"]=>
      string(20) "Item Chest (54:0)x13"
      ["unknown"]=>
      int(0)
      ["isEncoded"]=>
      bool(false)
      ["offset"]=>
      int(9)
      ["buffer"]=>
      string(18) "320300006c1a000000"
    }
    [17:17:18] [Server thread/DEBUG]: [PacketLogger] object(pocketmine\network\protocol\ContainerSetSlotPacket)#13967 (8) {
      ["windowid"]=>
      int(0)
      ["slot"]=>
      int(6)
      ["hotbarSlot"]=>
      int(0)
      ["item"]=>
      string(20) "Item Chest (54:0)x50"
      ["unknown"]=>
      int(0)
      ["isEncoded"]=>
      bool(false)
      ["offset"]=>
      int(9)
      ["buffer"]=>
      string(18) "32000c006c64000000"
    }
    
     
    Muqsit likes this.
  10. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    But how sure are you that it has to be that. It might've just logged the item being clicked from the GUI and not the item that isn't in either of the GUIs.
     
  11. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    In pocket edition you do not have items in that kind of floating gui inv. I didn't have win10 edition currently available.
     
  12. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Try the classic GUI, that might help.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.