mojira.dev
MC-197349

/loot can spawn air items that instantly despawn

Spawned item entities from a mobs loot table may not save their "Item" tag resulting in the item entities getting killed immediately after they have spawned. I have noticed this happening with the loot command. I don't know if the same applies to a natural scenario.

Reproduce

  1. Spawn in any mob whose loot table can drop items (e.g. creeper)

  2. Setup a command block chain:

    1. Impulse
      Set to: "Needs Redstone"

    2. Chain
      Set to: "Always Active"
      Command:

      loot spawn <pos> kill <the mob entity>

      e.g. after placing a witch near the command block:

      loot spawn ~ ~1 ~ kill @e[type=witch,distance=..5,limit=1]
    1. Chain
      Set to: "Always Active"
      Command:

      execute as @e[type=item] unless data entity @s Item run say hi

      Make sure the @e selector won't catch any other existing entities.

  1. Activate the impulse command block (probably multiple times)

You may notice the "Item" tag sometimes being omitted in the chat message.

Attachments

Comments 3

tryashtar

Confirmed and updated a bit

[Mod] Jingy

When trying to reproduce this issue in 24w36a, no command is output into the chat at all and the item doesn't get killed. Can you verify this issue still occurs in either the latest version or snapshot, and update the commands as necessary? A video of the issue occurring would also be helpful.

Nassim Jahnke

Added a specific example command to the second step, can still reproduce

Teixon

(Unassigned)

Confirmed

(Unassigned)

1.16.1, 1.21.1, 24w36a

Retrieved