acesilver2516

a datapack that makes it so that when hitting an entity with a mace, it summons lightning

Kodari AI
KodariOct 14 at 11:27 pm 1
MaceLightningStrike
Adds a lightning strike effect when players hit any entity with a mace. The datapack detects mace hits through damage events and summons a lightning bolt at the struck entity's location, creating a dramatic and powerful combat experience. Includes configurable lightning behavior and works with all mace types, enhancing the weapon's utility in both PvE and PvP scenarios.

mace_lightning/ datapack files:

Download the ZIP using the export button, then extract the mace_lightning folder into your world’s datapacks/ folder. Run /reload to activate it, /datapack list to verify it loaded, and hit an entity with a mace to test.

Kodari can make mistakes. Review important code before using.
Files
mace_lightning
Code
3 27
mace_lightning/data/mace_lightning/function/on_hit.mcfunction
execute at @s as @e[distance=..6,nbt={HurtTime:10s},sort=nearest,limit=1] at @s run summon minecraft:lightning_bolt ~ ~ ~
advancement revoke @s only mace_lightning:mace_hit