-1

I'm creating a datapack which lets you shoot small_fireballs with a carrot on a stick, and splash water bottles with another carrot on a stick. My issue is that whenever I run the function to summon the projectile, the projectile freezes about 3-10 blocks in front of me and then teleports/moves very quickly to wherever it's supposed to hit. I would like it to be smooth but I can't figure out why it is doing that. Here is a world download with both my datapacks for further clarification. Here is (as an example) my function to spawn in a small_fireball and shoot it:

#summon fireball
summon minecraft:small_fireball ^ ^ ^1 {CustomName:"\"firewandfireball\"",direction:[0d,0d,0d],power:[0d,0d,0d],ExplosionPower:0,life:60}

#get player and fireball data into scoreboards
execute as @s store result score @s fwx run data get entity @s Pos[0] 100
execute as @s store result score @s fwy run data get entity @s Pos[1] 100
execute as @s store result score @s fwz run data get entity @s Pos[2] 100

execute as @e[name=firewandfireball] store result score @s fwx run data get entity @s Pos[0] 100
execute as @e[name=firewandfireball] store result score @s fwy run data get entity @s Pos[1] 100
execute as @e[name=firewandfireball] store result score @s fwz run data get entity @s Pos[2] 100

#subtract the two to get a momentum/velocity and put into fireball's scoreboard
execute as @e[name=firewandfireball] store result score @s fwx run scoreboard players operation @s fwx -= @p fwx
execute as @e[name=firewandfireball] store result score @s fwy run scoreboard players operation @s fwy -= @p fwy
execute as @e[name=firewandfireball] store result score @s fwz run scoreboard players operation @s fwz -= @p fwz

#tp the fireball so it's like it's going from eye position
execute as @e[name=firewandfireball] at @s run tp @s ~ ~1.62 ~

#put the subtracted value into the fireball's direction and power
execute as @e[name=firewandfireball] store result entity @s direction[0] double 0.01 run scoreboard players get @s fwx
execute as @e[name=firewandfireball] store result entity @s direction[1] double 0.01 run scoreboard players get @s fwy
execute as @e[name=firewandfireball] store result entity @s direction[2] double 0.01 run scoreboard players get @s fwz

execute as @e[name=firewandfireball] store result entity @s power[0] double 0.01 run scoreboard players get @s fwx
execute as @e[name=firewandfireball] store result entity @s power[1] double 0.01 run scoreboard players get @s fwy
execute as @e[name=firewandfireball] store result entity @s power[2] double 0.01 run scoreboard players get @s fwz

The function to shoot the splash water bottle is exactly the same except instead of direction[] and power[] I'm using Motion[]. The result of shooting the fireball while strafing left looks like this: Shooting fireballs. Furthermore, the other projectiles in the datapack also exhibit the same behavior and have very similar looking functions, so the problem likely has to do with the method of shooting the projectile. I'm really at a loss so any help is appreciated.

Edit: Things I've tried so far:

Slowing down the projectile - Just makes it freeze closer to me.

Speeding up the projectile - Just makes it freeze farther away.

Speeding it up ridiculously - Instantly creates fire at target site but freezes at my feet.

  • And another one. Can you please only ask one question per problem and limit the code to that problem? – Fabian Röling Apr 20 at 13:38
  • @Fabian This is the first time I've posted about this problem. Previously I posted about the projectiles not going where they are aimed-this one is about them not flying smoothly. Should I delete this one and incorporate this question into the previous question? I'm new to Arqade so I just thought different questions, even if related, are supposed to be in different posts. – Nik3141 Apr 20 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.