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

`execute store` can't be chained

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Duplicate
    • Affects Version/s: Minecraft 18w05a
    • Fix Version/s: None
    • Labels:
      None
    • Confirmation Status:
      Unconfirmed

      Description

      If you try to use two `store` subcommands in one `execute` command (for instance, to store the success count and the result of the same command), only the last store will work; the first will be ignored.

      As a use case, I discovered this while trying to deal with an inventory's item stack counts. I have no way of knowing whether Items[i] exists for a given index i, but if it does, I want to add its Count tag to a score. Since there's nothing like `execute store add`, I needed to first store the result of `data get block ~ ~ ~ Items[i].Count`, then add the result to my running tally. But if there is no Items[i], that will fail and the value in the score won't be accurate for adding.

      I thought I should be able to do this: `execute store result score @s Count store success score @s Success run data get block ~ ~ ~ Items[i].Count`, then I could conditionally add Count to the total if Success is positive. But that's when this bug showed up and I realized only the last `store` subcommand will work, not all of them.

      *To Reproduce*
      1. Set up the Count and a Success dummy scoreboard objectives.
      2. From inside a chest block (or other inventory), run `execute store result score @s Count store success score @s Success run data get block ~ ~ ~ Items[0].Count`.

      Expected Result: If the chest is empty, @s Success will be 0; if it's not empty, @s Success will be 1 and @s Count will be the size of the first item stack.

      Actual Result: Success will be properly set to 1 or 0, but Count will never be set to the size of the stack, as that store subcommand is ignored.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                IceMetalPunk Daniel Burnett
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: