Entities tied to the previous UUIDs will not change
Entities tied to the previous UUIDs (like dogs, cats, villager trades) will not change. I had to op individual players and use commands to set pets' owner UUIDs for each players:
/execute as @e[type=wolf,distance=..10] run data modify entity @s Owner set from entity @p UUID
/execute as @e[type=cat,distance=..10] run data modify entity @s Owner set from entity @p UUID
/execute as @e[type=parrot,distance=..10] run data modify entity @s Owner set from entity @p UUID
Do you have any idea how to implement it?
Edit: Also thanks a lot for your help concerning the previous issue! I really appreciate your determination to help!! :)
Hi @BhasitL ,
I did a little investigation and found out it is actually possible to pull off, but will take a few late nights of coding to implement without bugs.
In short this is what has to be done if you have only a few entities you want to transfer over:
- Go into your world (in game) and locate an entity you want to change the owner of
- In the F3 Debug Menu look at the left side (around the middle) where chunk information is displayed. There will be a line that looks something like this: ... [0,31 ... r.0.-1.mca] ... (the numbers are just an example!)
- Locate your world folder, go into the entities folder and then locate the .mca file you saw in the F3 menu (e.g. r.0.-1.mca)
- Open this file with the NBTExplorer (Windows only, couldn't find anything for Mac/Linux)
- The top level entries will be chunk coordinates, find the one you saw in the F3 menu (e.g. 0,31)
- Go through all entities in that chunk until you find your target entity (dog, villager, ...)
- Convert the real owner's 128-bit UUID to 4 32-bit integers. This afaik can only be done via scripts you can find via Google (nothing tested yet)
- Find the "owner" entry of this entity and change its 4 32bit integer entry to be the representation of yours
- Save and reload your world. The e.g. dog should now recognize it's rightful owner again ^^
I will mention this issue in commits that work towards solving this problem to keep you posted. Cheers
Hi @paul-eff , Thanks a lot for the detailed instructions! I had actually tried NBTExplorer but I didn't know how to determine the chunk and the Owner field had a weird format not similar to the UUID which I know and it might be the 4 32 bit integer you're talking which I wasn't aware and there was no proper guide online as all were outdated and had a OwnerUUID field that does not exist in newer version. I shall give it a try! Tho, I had over 20 dogs which makes things a bit lengthier compared to the commands. Thanksss a lot!
for loop over all entities in the world and replace the UUIDs i suppose
In code this is sadly not as simple @EntityinArray because of the structure of the chunk/entity files. But you got me thinking and after a little research I found this reddit post .
Via in game commands/command blocks you @BhasitL should be able to query all entities of a specific type and change their owner. I am no expert on in game commands and data manipulation, more research and testing is definitely needed!
IMPORTANT - I did not test this command nor can I say if it even works, I just put together what I think could work:
When you're in game, this or a similar to this command could do the trick:
/execute as @e[type=wolf,nbt={Owner:"<Old_UUID>"}] run data merge entity @s {Owner:"<New_UUID>"}
Feel free to test and give me feedback. Cheers
Hi @paul-eff , Thanks a lot for the detailed instructions! I had actually tried NBTExplorer but I didn't know how to determine the chunk and the Owner field had a weird format not similar to the UUID which I know and it might be the 4 32 bit integer you're talking which I wasn't aware and there was no proper guide online as all were outdated and had a OwnerUUID field that does not exist in newer version. I shall give it a try! Tho, I had over 20 dogs which makes things a bit complicated compared to the commands. Thanksss a lot! Concerning the commands, that's what I used and they do work. Thanks a lot tho!
Welp, I initially thought this would be a more or less fast and fairly easy implementation: Turns out I first have to write a library that can properly read and write/update the other files. Then I can com back to this issue 😅...