Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-6355

#setItemOnCursor duplication / not updating inventory

XMLWordPrintable

    • 3007-Spigot-cd23533-a82b212 (MC: 1.16.5) latest
    • Yes

      Player/HumanEntity#setItemOnCursor(ItemStack item) sets the cursor item which I am using for my inventory click event to make a rename token. The set value is being changed but it's also not removing the previous item as the Javadocs describes on the cursor. The player is then able to keep a copy of the original item by placing it in an open slot while the set item (the token) is dropped to the ground once the inventory has been closed. If the item is still on the cursor when the inventory is closed the expected/set item drops. This set item is also the value that is returned when you run #getItemonCursor. 

      Expected Behavior: 

      The set item should replace the current item held in the cursor so the original duplicate item cannot be placed into the inventory. Currently as stated above if the original is held in the cursor and is not placed into a slot the expected item is dropped not the stone.

      My Usage:

      tokenStack.setAmount(tokenStack.getAmount()-1);
      targetMeta.setDisplayName(HexColor.format(foundValue));
      targetStack.setItemMeta(targetMeta);
      //e.getWhoClicked().setItemOnCursor(tokenStack);
      player.setItemOnCursor(tokenStack);
      
      // DEBUT -------------------------------------------------
      System.out.println(e.getWhoClicked().getItemOnCursor());
      
      player.updateInventory();
      e.setCancelled(true);

            Unassigned Unassigned
            brendanb8548@gmail.com Brendan Butters
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: