Datapack

ExplosiveTridentPack

Сделай мне дата пак В котором есть Трезубец который п попадание в Блок/моба/игрока взрывался с силой 2 вагонеток с тнт и чтобы он возврощался к владельцу и С задержкой на бросок было 8 секунд на версию 1.21.11

data/explosivetrident/functions/throw.mcfunction
# Prevent throwing again while the cooldown is active
execute store success score @s etPhase run scoreboard players if score @s etThrowTimer matches 1.. run tellraw @s [{"text":"Трезубец ещё перезаряжается.","color":"red"}]

# If cooldown is active, stop here
execute if score @s etThrowTimer matches 1.. run return 0

# Start the 8 second cooldown
scoreboard players set @s etThrowTimer 160

# Summon a marker so we can remember the owner and state of this trident
execute as @s at @s run summon minecraft:marker ~ ~ ~ {Tags:["et_trident_state"]}

# Tag the nearest freshly spawned trident as controlled by this pack
execute as @s at @s as @e[type=minecraft:trident,distance=..2,sort=nearest,limit=1] run tag @s add et_trident

# Store owner data on the thrown trident itself
execute as @s at @s as @e[type=minecraft:trident,tag=et_trident,distance=..2,sort=nearest,limit=1] run data modify entity @s item.components."minecraft:custom_data".et_owner set from entity @p[distance=..2,sort=nearest,limit=1] UUID

# Put the current trident position into scores for later motion comparisons
execute as @e[type=minecraft:trident,tag=et_trident,distance=..2,sort=nearest,limit=1] store result score @s etPrevX run data get entity @s Pos[0] 100
execute as @e[type=minecraft:trident,tag=et_trident,distance=..2,sort=nearest,limit=1] store result score @s etPrevY run data get entity @s Pos[1] 100
execute as @e[type=minecraft:trident,tag=et_trident,distance=..2,sort=nearest,limit=1] store result score @s etPrevZ run data get entity @s Pos[2] 100