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

Multiple "nbt=" arguments in selector serializes NBT multiple times

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.19.2
    • None
    • Confirmed
    • Commands
    • Normal
    • Platform

      As we know, the nbt selector argument is expensive because it involves serializing the entity's data. This only needs to be done once, but if the argument is used multiple times, serialization is performed multiple times unnecessarily, becoming even more expensive.

      How to reproduce

      Put the following commands in repeating command blocks:

      /execute if entity @e[nbt={}]
      /execute if entity @e[nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={},nbt={}]
      

      Expected result
      Both commands have near-identical performance

      Observed result
      The second command grinds the server to a halt

      Important note

      Obviously, multiple nbt= arguments can be combined, avoiding this issue. However, the negated form, nbt=!, cannot be combined without altering behavior. That is where this issue will be unavoidable

            Unassigned Unassigned
            tryashtar [Mod] tryashtar
            Votes:
            4 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              CHK: