mojira.dev
MC-296701

Transformed entities do not retain their custom_data component

Entities which are transformed from one type to another (e.g. a pig to a zombified piglin after being struck by lightning) do not retain their custom_data component (data NBT tag).

These entities do retain other data such as command tags and equipment, which are ways of storing arbitrary data.

This feature (all entities storing custom_data) was partly added to prevent the janky workaround of using items to store data on mobs. This bug causes a big issue there…

Steps to Reproduce:

  • Run the command /summon pig ~ ~ ~ {data:{foo:1}} to summon a pig with a custom_data component of {foo:1}

  • Summon a lightning bolt next to it with /summon lightning_bolt

  • Run /data get entity @n[type=zombified_piglin] data to observe that the data is now gone.

Observed Behaviour:

The custom_data component (data tag) is deleted when an entity is transformed to a different entity type.

Expected Behaviour:

The component (data tag) is retained when an entity is transformed to a different entity type, just like many other customisation tags.

Attachments

Comments 1

DorkOrc

gegy

Community Consensus

Platform

Normal

Commands

1.21.5, 25w15a

25w19a

Retrieved