THIS HAS BEEN RESOLVED!
Hi! So, I'm working on a datapack that modifies existing and adds new enchantments for the latest version of Minecraft (26.1). One enchantment I'm trying to make is called Buzzy, and one of the things I'd like it to do is have a chance to summon 3 bees that attack your attacker. Here's the function ran by the enchantment:
summon bee ~ ~ ~ {Tags:[SummonedByBuzzy]}
summon bee ~ ~ ~ {Tags:[SummonedByBuzzy]}
summon bee ~ ~ ~ {Tags:[SummonedByBuzzy]}
execute as @e[type=bee,tag=SummonedByBuzzy] run data modify entity @s angry_at set from entity @n[predicate=!isbuzzy,tag=!SummonedByBuzzy] UUID
execute as @e[type=bee,tag=SummonedByBuzzy] run data modify entity @s Anger set value 300
The predicate is just to check for players wearing a chestplate enchanted with Buzzy, as otherwise your own bees would attack you.
{
"condition": "entity_properties",
"entity": "this",
"predicate": {
"slots": {
"armor.chest": {
"predicates": {
"enchantments": [
{
"enchantments": "buzzy"
}
]
}
}
}
}
}
The bees are in fact summoned, but no matter what I do, they refuse to attack any entity. I've spent around 2 hours trying a multitude of different things, browsing through forums and watching videos but all to no avail. Making this post and hoping someone can help is my last resort before I give up on this. If this isn't possible to do, I'll have to give up either way, but if anyone has any idea how to help, please let me know, I'd greatly appreciate it!
Edit: as suggested by a comment, I used the /damage command instead, (and also made the bees incapable of escaping into hives) making the function now look like this:
summon bee
~ ~1 ~
{Tags:[SummonedByBuzzy],CannotEnterHiveTicks:999999999}
summon bee
~ ~1 ~
{Tags:[SummonedByBuzzy],CannotEnterHiveTicks:999999999}
summon bee
~ ~1 ~
{Tags:[SummonedByBuzzy],CannotEnterHiveTicks:999999999}
damage @e[type=bee,tag=SummonedByBuzzy,limit=1] 0 generic by @n[predicate=!isbuzzy,tag=!SummonedByBuzzy]
However, the first three bees summoned seem to either not get angry or stop being angry immediately. Subsequent bees will get angry and attack the target, causing the target to attack back, causing all bees to attack, but this essentially makes the first bees summoned useless until there are more.