-
Bug
-
Resolution: Unresolved
-
None
-
1.16.2, 1.16.5, 21w11a, 1.19.2
-
None
-
Minecraft: Java edition,1.16.1 (vanilla)
Java: 1.8.0_51 64bit
OS: Windows
-
Confirmed
-
Commands
— TL;DR
When changing the position of an entity by /data or /execute store in the same tick the entity is spawned, the entity is confused. Teleporting the entity by /tp, even in the same tick, fixes this.
— Reproduce
The most basic example is:
/summon minecraft:armor_stand ~ ~1 ~ NoGravity:1b,Tags:["testing"]
/data modify entity @e[tag=testing,limit=1] Pos[1] set value 7d
(Run these commands in the same tick.)
The bug also occurs with /execute store (setup with /data modify storage teststore path set value 7d):
/summon minecraft:armor_stand ~ ~1 ~ NoGravity:1b,Tags:["testing"]
/execute store result entity @e[tag=testing,limit=1] Pos[1] double 1 run data get storage teststore path 1
— Behaviour
I refer to the location where the entity was summoned as the render location, and the location the entity should have after chaning Pos as the actual location.
If the entity is "pseudo-teleported" in this way, it is rendered at its render location. F3+B also shows the hitbox at the render location. Sounds originate from its actual location. Kill particles, as well as drops or XP, originate from the actual location. Trying to hit the entity does not work at the actual location; and at the render location only if the render and actual locations don't differ too much.
Teleporting the entity seems to fix these problems, see below. Changing the position by modifying the entity's NBT later moves the actual position as expected, but also moves the render location by the distance the entity effectively moved. In other words, the difference between the actual and render locations stays the same.
— Working around
Reloading the wolrd seems to fix these problems (everything happens at the actual location), as does leaving the renderdistance and coming back. Sometimes the entity even seems to snap to the actual location on its own.
Using commands, this can be fixed by teleporting the entity. (/tp @s ~ ~ ~ and /tp @s @s both work.) It even works if the /tp is executed in the same tick as the entity is summoned and moved via modifying its NBT; and even if /tp is executed between /summon and the /data modify or /execute store, respectively.
PS: The attached structurefile contains some examples. Load it at Y=4.
- is duplicated by
-
MC-221412 execute store with scoreboard to data doens't work properly
- Resolved