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

/spreadplayers does not affect entities with no death animation that were killed previously in the same function

XMLWordPrintable

    • Confirmed
    • Commands, Data Packs
    • Low
    • Platform

      If a function, running as an entity (@s) with no death animation, kills the entity and then tries to run /spreadplayers targetting it, the command will "succeed" but the entity will not be moved at all.
      This was not the case in versions prior to 24w33a (1.21.1 and prior).

      You can work around this fairly simply by doing the kill after the spreadplayers, but this behaviour is inconsistent with other commands in the game, breaks previously written code, and was not mentioned in the changelog.

      Steps to Reproduce:

      1. Download the attached data pack and enable it in a world in 1.21.1.
      2. Run the following commands several times each to see what they output:
        execute positioned 0.0 0.0 0.0 summon marker run function mc-275685:kill_first
        execute positioned 0.0 0.0 0.0 summon pig run function mc-275685:kill_first
        
        execute positioned 0.0 0.0 0.0 summon marker run function mc-275685:kill_after
        execute positioned 0.0 0.0 0.0 summon pig run function mc-275685:kill_after
      3. Update to 24w33a or 24w34a and run the same commands several times each.

      You can also test this out with other entities. You can swap out pig for any mob, and you can swap out marker for entities such as item_display, interaction, armor_stand, etc.

      Observed Results:

      • In 1.21.1, all of the commands correctly spread the entity to some nearby location in the world; print out their (random) coordinates into the chat window to all players; and kill the entity.
      • In 24w33a, the commands that run the mc-275685:kill_after function work as expected, but the commands that run the mc-275685:kill_first function only work as expected for the pig. When ran by a marker, it always prints the coordinates as [0.0d,0.0d,0.0d] (or whatever coordinates you enter after positioned).

      In both versions, the entity is killed no matter what but the difference is whether they are repositioned by the /spreadplayers command or not.

      All of the functions also print a "success = 1" which represents the success value of the /spreadplayers command, i.e. the command was "successful", despite not moving the entity.

      Expected Results:

      In either version, both functions should spread the entity to some nearby location and print out their coordinates, resulting in random numbers being printed to chat, not 0 0 0 always, no matter what entity it runs as.
       

            Unassigned Unassigned
            Deoxyribonucleic Evans DorkOrc
            Votes:
            5 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              CHK: