Kristóf

Can you make a datapack for the spear to be comtapabel with riptide enchantment just like a trident and you can use without water

Kodari AI
KodariOct 31 at 6:41 pm 1
SpearRiptideCompatibility
Adds full Riptide enchantment compatibility to spears, allowing players to launch themselves through the air when throwing a spear enchanted with Riptide, just like a trident. The datapack modifies spear behavior so Riptide activates without requiring water or rain, enabling aerial mobility and combat. Includes custom loot tables, enchantment handling, and particle effects to mimic trident functionality seamlessly.

Created a vanilla datapack that gives you a Riptide III trident renamed Spear, plus a dry dash. Vanilla 1.21.4 has no spear item, and a datapack cannot change Riptide’s built-in right-click behavior, so activate the dash with /trigger spear_launch set 1 while holding the Spear.

Download the ZIP with the export button, extract spear_riptide into world/datapacks/, then run /reload. Check it with /datapack list, get the Spear using /function spear_riptide:get_spear, and dash while holding it using /trigger spear_launch set 1.

Kodari can make mistakes. Review important code before using.
Files
spear_riptide
Code
7 27
spear_riptide/data/spear_riptide/function/tick.mcfunction
scoreboard players add @a spear_cd 0
scoreboard players remove @a[scores={spear_cd=1..}] spear_cd 1
scoreboard players enable @a spear_launch
execute as @a[scores={spear_launch=1..,spear_cd=0}] if items entity @s weapon.mainhand minecraft:trident[minecraft:custom_data~{spear_riptide:1b}] at @s run function spear_riptide:launch
execute as @a[scores={spear_launch=1..,spear_cd=0}] unless items entity @s weapon.mainhand minecraft:trident[minecraft:custom_data~{spear_riptide:1b}] run tellraw @s {"text":"Hold your Spear in your main hand to use the dry Riptide dash.","color":"red"}
scoreboard players set @a[scores={spear_launch=1..}] spear_launch 0