mojira.dev
MC-102170

Leads stay on the old place when copied in a new place using Structure Block.

Steps to reproduce:

  1. Save a structure with a mob on a lead with a knot on a fence

  2. Remove the knot from the fence or
    Remove the fence

  3. Load 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

Attachments

Comments 2

The problem is very likely that the X, Y and Z values of the Leash tag are not updated.

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.

Flashee

(Unassigned)

Confirmed

Minecraft 16w20a, Minecraft 1.10.2, Minecraft 16w32a, Minecraft 16w32b, Minecraft 16w33a, Minecraft 16w36a, Minecraft 16w38a, Minecraft 16w39a, Minecraft 16w39b, Minecraft 16w39c

Retrieved