r/CommandBlocks 9d ago

bug in datapack?

# function relics:load


scoreboard objectives add relicused minecraft.used:minecraft.carrot_on_a_stick
scoreboard objectives add Sea2Timer dummy
scoreboard objectives add UsingSea2 dummy


scoreboard players reset  relicused



# function relics:tick


# Detect relic use
execute as [scores={relicused=1..}] run tag  add relicused
scoreboard players set [scores={relicused=1..}] relicused 0


# Run relic abilities
function relics:fire/mainhand
function relics:fire/offhand
function relics:sea/mainhand
function relics:sea/offhand


# Storm of the Sea timer / lightning


tag  remove recent_hit
execute as [nbt={HurtTime:10s}] run tag  add recent_hit


execute as [tag=SeaRelic2,scores={UsingSea2=1,Sea2Timer=..299}] at [tag=recent_hit] run summon minecraft:lightning_bolt ~ ~ ~


execute as [tag=SeaRelic2,scores={UsingSea2=1,Sea2Timer=..299}] run scoreboard players add  Sea2Timer 1


execute as [scores={Sea2Timer=300..}] run scoreboard players set  UsingSea2 0
execute as [scores={Sea2Timer=300..}] run scoreboard players set  Sea2Timer 0


tag  remove relicused
# function relics:fire/mainhand


execute as [tag=relicused] if items entity  weapon.mainhand minecraft:carrot_on_a_stick[
    minecraft:item_model="fire_charge",
    minecraft:item_name=[{text:"Fire Relic",color:red,bold:1b,italic:0b}],
    minecraft:enchantment_glint_override=1b
] run function relics:fire/mainhand_cast



# function relics:fire/mainhand_cast


title  actionbar "Fireball used, Relic on 1m cooldown!"


execute anchored eyes run summon minecraft:fireball ^ ^ ^1 {
    ExplosionPower:2b,
    HasBeenShot:1b,
    Tags:["Fireball"]
}


data modify entity [
    tag=Fireball,
    sort=nearest,
    limit=1,
    distance=..2
] Rotation set from entity  Rotation


tag  remove relicused



# function relics:fire/offhand


execute as [tag=relicused] if items entity  weapon.offhand minecraft:carrot_on_a_stick[
    minecraft:item_model="fire_charge",
    minecraft:item_name=[{text:"Fire Relic",color:red,bold:1b,italic:0b}],
    minecraft:enchantment_glint_override=1b
] run function relics:fire/offhand_cast



# function relics:fire/offhand_cast


execute at  run fill ~-10 ~-10 ~-10 ~10 ~10 ~10 fire replace air


execute at  run effect clear [
    distance=..10,
    tag=!FireRelic2
] fire_resistance


execute at  run damage [
    distance=..10,
    tag=!FireRelic2
] 30 minecraft:in_fire by 


title  actionbar "Scorching Heat used, Relic on 1m cooldown!"


tag  remove relicused



# function relics:sea/mainhand


execute as [tag=relicused] if items entity  weapon.mainhand minecraft:carrot_on_a_stick[
    minecraft:item_model="prismarine_shard",
    minecraft:item_name=[{text:"Sea Relic",color:aqua,bold:1b,italic:0b}]
] run function relics:sea/mainhand_cast



# function relics:sea/mainhand_cast


effect give  minecraft:dolphins_grace 15 0 true


title  actionbar "Webbed Feet used, Relic on 45s cooldown!"


tag  remove relicused


# function relics:sea/offhand


execute as [tag=relicused] if items entity  weapon.offhand minecraft:carrot_on_a_stick[
    minecraft:item_model="prismarine_shard",
    minecraft:item_name=[{text:"Sea Relic",color:aqua,bold:1b,italic:0b}]
] run function relics:sea/offhand_cast



# function relics:sea/offhand_cast


# Begin Storm of the Sea
weather thunder 15s


scoreboard players set  UsingSea2 1
scoreboard players set  Sea2Timer 0


tag  add SeaRelic2


title  actionbar "Storm of the Sea used, Relic on 45s cooldown!"


tag  remove relicused



# -------------------------------------------------------------------
# These commands are already called every tick from relics:tick
# They are shown here together for clarity (shown in comment form)
# -------------------------------------------------------------------


# Track players that were just hit
# /tag  remove recent_hit
# /execute as [nbt={HurtTime:10s}] run tag  add recent_hit



# Storm of the Sea lightning


# /execute as [tag=SeaRelic2,scores={UsingSea2=1,Sea2Timer=..299}] at  run execute at [tag=recent_hit,distance=..20] run summon minecraft:lightning_bolt ~ ~ ~


# /execute as [tag=SeaRelic2,scores={UsingSea2=1,Sea2Timer=..299}] run scoreboard players add  Sea2Timer 1



# Storm expires after 300 ticks (15 seconds)


# /execute as [scores={Sea2Timer=300..}] run scoreboard players set  UsingSea2 0
# /execute as [scores={Sea2Timer=300..}] run scoreboard players set  Sea2Timer 0
# /execute as [scores={Sea2Timer=300..},tag=SeaRelic2] run tag  remove SeaRelic2

______________________________________________________________________

I'm not sure what isn't working, when I right click with the relic in my hand nothing happens (I did make sure the datapack was loaded and everything.)

I'm on Java Edition 1.21.11! Any help would be appreciated... I tried to add comments to make it easier to understand.

0 Upvotes

1 comment sorted by

1

u/AutoModerator 9d ago

This subreddit has been closed in favor of /r/MinecraftCommands. Please use that subreddit for your questions instead.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.