Arqade Asked by Gorm on April 10, 2021
I’m on 1.16 Java and I have successfully used /data merge before.
This time I’m trying to "spawn" wolves (merge passenger data) onto my villagers so I can set the AngryAt value of the wolves to be angry at a player who opens a chest in a village. The jockey of a mob takes over path finding for the mob, so in theory I have seen this work online with summoning mobs with mobs as jockeys, and it works in testing, but for some reason to merge passenger data of a villager outputs as success but doesn’t actually do anything. Here’s an example of the simplest test I have tried…
This works and properly spawns a villager with wolf on it’s head:
summon villager ~ ~1 ~ {Passengers:[{id:wolf}]}
but this doesn’t put a wolf on the head of villager:
execute as @e[type=villager] run data merge entity @s {Passengers:[{id:"wolf"}]}
The second actually validates in the chat window and lists all the villagers that it’s altered the data for, but then absolutely nothing is changed, there isn’t even passenger data when I do a /data get on them.
The ONLY thing I can think of is that I need a wolf to merge the passenger data from?? I know that you can only merge data for one entity at a time, and that’s what it’s run as the villager themselves, each using merge data on themselves only once each. Using modify instead of merge doesn’t even produce an output.
What am I doing wrong?
Edit: OK I’m looking into if it’s my fault now. I wrote the whole thing last night before bed without debugging because I just needed to write down my idea, then tried to run it today and fix everything and just realized I added something about killing the invulnerable villager when the jockey is killed because in my initial tests the zombie I used would kill the villager if they weren’t attacking a player, so I made the villagers invulnerable to attack, and made the jockeys take the damage from the player… now I think the jockeys are dissappearing in the same tick I spawn them… but I don’t know why yet…
EDIT 2: had nothing to do with despawn, but does have everything to do with not being able to reach the Passengers NBT tag with target selectors. As mentioned above, I can’t see the wolf as a passenger when I search and retrieve a named villager’s NBT data, UNLESS I am looking at the villager, and the chat auto prompts with their UUID, if I search their data with that, I can see that there is a named wolf as their passenger. I think the passenger tag may not be searchable or editable without providing a UUID for the mob being ridden.
While I’m testing this further, can anyone tell me how to store/targe UUIDs of many different entities, on the fly?
Edit 3: Ok I have no idea how NBT and data merge work. There is no consistency. I have noticed that you are not allowed to "merge" any NBT data of any tags that can be controlled by other means (Effects, and literal "Tags" tag, and Team, all of which are their own commands)
These work (as there is no "invulnerable" command):
execute as @e[type=wolf] run data merge entity @s {Invulnerable:1b}
execute as @e[type=wolf] run data merge entity @s {Invulnerable:0b}
These do not:
execute as @e[type=wolf] run data merge entity @s {Invisible:1b}
execute as @e[type=wolf] run data merge entity @s {ActiveEffects:[{Id:14,Amplifier:0,Duration:99999}]}
execute as @e[type=wolf] run data merge entity @s {Tags:WolfJockey}
execute as @e[type=wolf] run data merge entity @s {Team:Anything}
Is my problem that I’m not targeting the correct NBT path with the last four examples? Why is it that all of those work in a summon function:
summon villager ~ ~1 ~ {Passengers:[{id:"wolf",CustomName:'"VillagerAnger"',ActiveEffects:[{Id:14,Amplifier:0,Duration:99999}]}],Invulnerable:1b,Tags:[Town1Villager]}
Okay, I've tested it out and found something interesting. I tried this command from your question:
execute as @e[type=wolf] run data merge entity @s {ActiveEffects:[{Id:14,Amplifier:0,Duration:99999}]}
Now... be patient! Wait about 30 seconds. Does the wolf receive the effect now?
For me, it takes about 30 seconds for the effect to show up. However, during that 30 second period, try running this command a few times:
data get entity @e[type=wolf] ActiveEffects
Notice something? The NBT data is there, but for some reason isn't showing up on the mob itself.
This is because the server has received those changes but hasn't told the client side to update. To update it, you must air toggle it:
execute as @e[type=wolf] store result entity @s Air short 1 run time query gametime
Answered by ExpertCoder14 on April 10, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP