Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-252484

player_hurt_entity advancement detects "ghost NBT" in empty hotbar slots

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • 1.18.2, 1.19 Release Candidate 2
    • None
    • Unconfirmed
    • (Unassigned)

      If a player throws out an item using Q, until the hotbar slot changes again, a player_hurt_entity advancement trigger will detect the NBT data the thrown item possessed as though the player still has that item in their hand. This "ghost data" is persistent in that specific hotbar slot until the player relogs or an item is put into that slot.

      To reproduce, load the attached datapack, and run this command:
      /give @s stone{Test:1}

      Hit any entity with the resulting item, and you'll see the advancement function say "Trigger!" and "Found!" in chat.

      Press Q to throw away the item, then hit an entity with that same now-empty hotbar slot selected. You'll still get the advancement saying "Trigger!" in chat. (It will not say "Found", as that's run by an execute if data entity @s command that sees you don't have an item with the test data selected.)

            Unassigned Unassigned
            GrifterMage Callum Milne
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: