Damage function causes mobs to drop no loot or xp
Minecraft Version: 1.20.2 No Mods or Plugins Singleplayer
I am attempting to use a raycast function for a "spirit staff" ability in my datapack, and it has shown very inconsistent behavior. When killing individual mobs, it seems to prevent them from dropping items or XP, however when multiple mobs are involved, they will drop their loot and xp inconsistently.
(The following commands are portions of the full functions for the most part) I have a sub-ticking function that runs the selector for the type of "spell":
execute if entity @s[scores={SR.CustomMain=6,SR.spiritdream=1..}] run function shamanism:staff_effects/aloof/aloof_spells/select"Select":
execute if entity @s[predicate=!shamanism:is_sneaking] run function shamanism:staff_effects/aloof/aloof_spells/spirit_type"Spirit Type":
execute if score @s SR.Spirit matches 1 if score @s SR.spiritfraga matches 4.. anchored eyes positioned ^ ^ ^0.5 if block ~ ~ ~ #shamanism:blockignore run function shamanism:staff_effects/aloof/aloof_spells/spirits/polar_bear/swipe_1"swipe_1":
execute run function shamanism:staff_effects/aloof/aloof_spells/spirits/polar_bear/swipe_2"swipe_2":
particle sweep_attack ~ ~ ~ 0.15 0.15 0.15 0.15 1 force @a[tag=!global.ignore,tag=!global.ignore.gui,distance=..40] execute positioned ~-1.5 ~-1.5 ~-1.5 as @e[tag=!SR.spiritraycast,tag=!global.ignore,dx=2,dy=2,dz=2,limit=10] positioned ~1.5 ~1.5 ~1.5 run function shamanism:staff_effects/aloof/aloof_spells/spirits/polar_bear/swipe_effect scoreboard players add @s SR.range 1 #raycast loop# execute unless entity @s[scores={SR.range=4..}] if block ~ ~ ~ #shamanism:blockignore positioned ~ ~-0.9 ~ unless entity @e[distance=..0.75,type=!#shamanism:spiritraycastban,tag=!SR.spiritraycast] positioned ^ ^ ^0.9 positioned ~ ~0.9 ~ run function shamanism:staff_effects/aloof/aloof_spells/spirits/polar_bear/swipe_2 tag @s[scores={SR.range=4..}] remove SR.spiritraycast scoreboard players set @s[scores={SR.range=4..}] SR.range 0``` "Swipe Effect": ```damage @s 6 magic by @p from @p```