#Entity spawned on the same tick won't instantly move when changing Motion data

1 messages · Page 1 of 1 (latest)

buoyant harness
#

1.21.6!

I'm just trying to make a throwable item (With gravity) so i just made an advancement for when i consume the item, and run a throw function. In the function i then summon an invisible armor stand with a custom model on it head. I then use scoreboards to calculate how the armor stand should move, based on where the players looking. I then use execute store and scoreboard get to store the results of the calculation into the armor stands Motion nbt.

My problem is that it works, but the armor stand doesn't instantly start moving, and just sits still for a sec before the Motion seems to get applied properly.

If anybody knows how to fix it, it would be appreciated 🙂

Motion calc code if anybodys wondering:

execute store result score @s sprite.dash.dx1 run data get entity @s Pos[0] 1000
execute store result score @s sprite.dash.dy1 run data get entity @s Pos[1] 1000
execute store result score @s sprite.dash.dz1 run data get entity @s Pos[2] 1000

tp @s ^ ^ ^0.1

execute store result score @s sprite.dash.dx2 run data get entity @s Pos[0] 1000
execute store result score @s sprite.dash.dy2 run data get entity @s Pos[1] 1000
execute store result score @s sprite.dash.dz2 run data get entity @s Pos[2] 1000

scoreboard players operation @s sprite.dash.dx2 -= @s sprite.dash.dx1
execute store result entity @s Motion[0] double 0.005 run scoreboard players get @s sprite.dash.dx2

scoreboard players operation @s sprite.dash.dy2 -= @s sprite.dash.dy1
execute store result entity @s Motion[1] double 0.005 run scoreboard players get @s sprite.dash.dy2

scoreboard players operation @s sprite.dash.dz2 -= @s sprite.dash.dz1
execute store result entity @s Motion[2] double 0.005 run scoreboard players get @s sprite.dash.dz2

pale mist
#

Optimal method of summoning an entity with motion, stolen from HeDeAn

execute positioned 0.0 0.0 0.0 run summon marker ^ ^ ^1 {Tags:["setup"]}

execute as @n[type=marker,tag=setup] run data modify entity @s Motion set from entity @s Pos

execute anchored eyes run tp @n[type=marker,tag=setup] ~ ~ ~

tag @e[type=marker,tag=setup] remove setup
#

You just execute this rotated as the thrower

#

(And of course change the entity type accordingly)

buoyant harness
#

Ty will try

#

I mean it works and is a lot simpler now, but theres still a tick or two where it just stands completely still, before beginning to move?

pale mist
#

Is is that noticeable?

#

Or that big a deal?

buoyant harness
#

No not really, cuz changed it to tp to a bit behind your head so thx

lapis locust
#

i cant see why he cant just do that

pale mist
lapis locust
#

no...

pale mist
#

That's always going to have motion in the same direction regardless of the direction the thrower is facing.

lapis locust
#

Oh

#

OJHHHH

#

i misread that

#

mb

buoyant harness
#

All good