OK so I have made a sorta sword sheath mechanic where if I sneak it replaces the sword in my hand with a Sheathed variant
And if I attack an entity with the Sheathed variant it swaps to the unsheathed variant
And it works fine......until I actually hit an entity
When I'm in creative mode and I hit a block, it works fine
But when I hit and entity, the sword doesn't swap to the unsheathed variant
I'm using /replaceitem to make it swap
It's super frustrating as I don't get why it works When I hit a block, but not an entity
Everything in the function works, apart for the replaceitem command which by the way is fine cuz it works When I hit a block and I've tested it
scoreboard players add @s[tag=samurai] m1_katana 1
playanimation @s[tag=samurai,scores={m1_katana=1}] animation.samurai.m1.katana1
playanimation @s[tag=samurai,scores={m1_katana=2}] animation.samurai.m1.katana2
playanimation @s[tag=samurai,scores={m1_katana=3}] animation.samurai.m1.katana3
playanimation @s[tag=samurai,scores={m1_katana=4}] animation.samurai.m1.katana4
playanimation @s[tag=samurai,scores={m1_katana=5}] animation.samurai.m1.katana5
replaceitem entity @s[hasitem={location=slot.weapon.mainhand,item=ronin:katana_sheathed,quantity=1}] slot.weapon.mainhand 0 ronin:katana_unsheathed 1
camerashake add @a[tag=samurai,r=2] 0.2 0.1
playsound sword.swing @s[tag=samurai]
particle ronin:slash ^^0.8^1
tellraw @s[tag=!samurai] {"rawtext":[{"text":"§cYou have no knowledge or Understanding on how to use this weapon. \nIt is irrelevant to you§f"}]}
#blessingfire
execute as @s[tag=blessing_fire2] at @s positioned ~~~ run playsound mob.blaze.shoot @a[r=10]
execute as @s[tag=blessing_fire2] at @s positioned ^^^ run particle ronin:blessing_fire_m1 ^^0.8^