0

Right now, I'm making a "Fire Hose" item which shoots splash water bottles. I've got the velocity and everything working but for some reason it falls much quicker than I expected, and the trajectory is as if I've thrown it. I've tried the NoGravity tag but it isn't working, so if there is a way to get it to go where the cursor is pointing aside from raycasting and spawning it in at that block that would be great. Here's my function to shoot it: the summon command is on line two:

#summon water
summon minecraft:potion ^ ^ ^1 {NoGravity:1,CustomName:"\"firewandwater\"",Potion:{id:"minecraft:splash_potion",Count:1,tag:{Potion:"minecraft:water"}}}

#get player and water 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=firewandwater] store result score @s fwx run data get entity @s Pos[0] 100
execute as @e[name=firewandwater] store result score @s fwy run data get entity @s Pos[1] 100
execute as @e[name=firewandwater] store result score @s fwz run data get entity @s Pos[2] 100

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

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

#put the subtracted value into the potion's Motion
execute as @e[name=firewandwater] store result entity @s Motion[0] double 0.01 run scoreboard players get @s fwx
execute as @e[name=firewandwater] store result entity @s Motion[1] double 0.01 run scoreboard players get @s fwy
execute as @e[name=firewandwater] store result entity @s Motion[2] double 0.01 run scoreboard players get @s fwz

#reset the scoreboards
scoreboard players reset @e fwx
scoreboard players reset @e fwy
scoreboard players reset @e fwz
execute run scoreboard players reset firewandClicks
execute run scoreboard players set @e firewandClicks 0

#reset customName so ater isn't affected by new ater
execute as @e[name=firewandwater] at @s run data merge entity @s {CustomName:""}

The water should be hitting the top of the brick wall, but instead it hits the middle: enter image description here

bumped to the homepage by Community 2 days ago

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

  • 1
    Have you tried to isolate the problem? The summoning part itself doesn't seem to be faulty, as NoGravity:1 seems to be working when I run only the summoning command. Try to find the part of code that prevents the potion from flying straight, or include a world download so we can take a closer look at your problem. – Quijibo Apr 19 at 17:40
  • Just realized I had lines identical to the Motion[] ones but with direction[] and power[] which led to it going in the wrong trajectory. Problems with reusing old code I guess. – Nik3141 Apr 19 at 18:20
  • 1
    So you got it working properly now? – Quijibo Apr 19 at 18:24
  • @Quijibo Yeah it works however I made a new question at gaming.stackexchange.com/questions/349225/… for a different issue I had with it. – Nik3141 Apr 19 at 20:24
  • These commands look very familiar. Did you just repost your question? – Fabian Röling Apr 20 at 13:37
0

Get a repeating, always active command block. Type in /execute @e[type=splash_potion] ~~~ tp @e[type=splash_potion, r=3] ~~~(use coordinates with decimals to get it to move, for example: ~.3~~ or ~~~.4) it should work.

  • 1
    If you didn't notice from the comments on the question, this problem was already solved. There's a new question about this topic here. – Quijibo Apr 20 at 8:38

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.