Steps to reproduce:
Save a structure with a mob on a lead with a knot on a fence
Remove the knot from the fence or
Remove the fenceLoad the structure in any other place.
Result: a new knot will always appear on the old place, but a new lead won't appear until reopening the world (possibly because of MC-55851).
If there is no fence and/or the new structure is far enough, the new lead will break and drop itself.
If there is the fence, the knot will stay there (even if the lead breaks, but it'll disappear after reloading the world), or else it'll despawn.
The cause is that the coordinates of the knot are saved in the entity, but are not changed when loading the structure
Old description:
I used a Structure Block, saved a house, and loaded it but the lead, attaching a cow and a fence together, broke as soon as it was copied to its new position.
Linked issues
duplicates 1
Attachments
Comments 2
I would suggest combining all bugs regarding NBT values of entities not correctly written / read when saving / loading structures in one report. As far as I know the only way to currently solve this is to have a "hack" which acts for all hardcoded NBT tags which require special treatment. Having all these bugs in seperate reports might result in the developers missing one situation.
At some point all NBT tags might be represented as data parameters in the data manager. Then these parameters could define which kind of data they contain, if they contain the data of itself or another entity. Which would not need hardcoded tags then.
Possible fix concept
Block positions
Just write and read the relative block position. For example the value of the X
tag of the Leash
tag would be 5 if the leash knot was at 610 and the structure starts at 605.
Entity UUIDs
A new referencedEntities
tag could be added in the same compound nbt
is in. This could contain the tag names as key and an int representing the index of the entity it selected before.
For example:
EntityA
{
CustomName:"EntityA",
UUIDLeast:5,
UUIDMost:0,
}
EntityB
{
CustomName:"EntityB",
Leash: {
UUIDLeast:5,
UUIDMost:0
}
}
would become
{
entities: [
{
nbt: {
CustomName: "EntityA"
}
},
{
nbt: {
CustomName: "EntityB"
},
referencedEntities: {
UUIDLeast: 0, // Use UUID of entity with index 0
UUIDMost: 0 // Use UUID of entity with index 0
}
]
}
When reading the structure data, the referencedEntities
would need to be applied once all entities are spawned.
The problem is very likely that the
X
,Y
andZ
values of theLeash
tag are not updated.