#Spawns instantly flying fireballs at a specific point

1 messages · Page 1 of 1 (latest)

fathom spruce
#

I need help, I need to spawn a fireball 50 blocks high from me, flying to the point where I was looking, according to a certain condition, when my condition was met

fathom spruce
#

1.21.11

brazen ledge
#

What's the condition?

fathom spruce
#

wait a second

#

I have already written down the condition, briefly , when I use a carrot on a fishing rod, while holding a honeycomb in offhand, then spawn should occur

brazen ledge
#

It will be a multi-command process

#

This should work in your datpack!

scoreboard objectives add crod_used used:carrot_on_a_stick
scoreboard objectives add fball dummy
execute as @a[scores={crod_used=1..}] if entity @s[nbt={Inventory:[{Slot:-106b,id:"minecraft:honeycomb"}]}] run function fball:launch
scoreboard players set @a[scores={crod_used=1..}] crod_used 0
execute anchored eyes run summon marker ^ ^ ^100 {Tags:["fball_target"]}
summon marker ~ ~50 ~ {Tags:["fball_origin"]}
execute store result score #tx fball run data get entity @e[tag=fball_target,limit=1] Pos[0] 100
execute store result score #ty fball run data get entity @e[tag=fball_target,limit=1] Pos[1] 100
execute store result score #tz fball run data get entity @e[tag=fball_target,limit=1] Pos[2] 100
execute store result score #ox fball run data get entity @e[tag=fball_origin,limit=1] Pos[0] 100
execute store result score #oy fball run data get entity @e[tag=fball_origin,limit=1] Pos[1] 100
execute store result score #oz fball run data get entity @e[tag=fball_origin,limit=1] Pos[2] 100
scoreboard players operation #dx fball = #tx fball
scoreboard players operation #dx fball -= #ox fball
scoreboard players operation #dy fball = #ty fball
scoreboard players operation #dy fball -= #oy fball
scoreboard players operation #dz fball = #tz fball
scoreboard players operation #dz fball -= #oz fball
execute store result storage fball:data dx double 0.0001 run scoreboard players get #dx fball
execute store result storage fball:data dy double 0.0001 run scoreboard players get #dy fball
execute store result storage fball:data dz double 0.0001 run scoreboard players get #dz fball
execute at @e[tag=fball_origin,limit=1] run function fball:summon_fireball with storage fball:data
kill @e[tag=fball_target]
kill @e[tag=fball_origin]
$summon fireball ~ ~ ~ {direction:[$(dx)d,$(dy)d,$(dz)d],ExplosionPower:1} ```
last stratus
#

That is some old and very deprecated code you use there

#

You can simplify that by a lot and make it more performant too

#

give me a sec

fathom spruce
#

Ok

brazen ledge
echo dustBOT
#

start.mcfunction (has to be executed as and at the player)

# code for your carrot on a stick reset
# ...

execute unless items entity @s weapon.offhand honeycomb run return fail

execute anchored eyes run function namespace:mark_target_pos
execute positioned ~ ~50 ~ summon marker run function namespace:setup_fireball_motion
execute positioned ~ ~50 ~ summon fireball run data modify entity @s Motion set from entity @e[type=marker,tag=fireball_setup,tag=fireball_motion,limit=1] Pos
kill @e[type=marker,tag=fireball_setup]

mark_target_pos.mcfunction

execute unless block ~ ~ ~ air run summon marker ~ ~ ~ {Tags:["fireball_setup", "target_pos"]}
execute if block ~ ~ ~ air positioned ^ ^ ^0.2 run function namespace:mark_target_pos

setup_fireball_motion.mcfunction

tag @s add fireball_setup
tag @s add fireball_motion

execute at @s run rotate @s facing entity @e[type=marker,tag=fireball_setup,tag=target_pos,limit=1]
execute positioned 0 0 0 run tp @s ^ ^ ^1
fathom spruce
last stratus
#

I can look at it once I get back home (tbh, I didn't fully test the code I just wrote it and pressed send).

fathom spruce
#

No problem, write if you need any information about my code.