The bug
Despite MC-65953 being fixed, the IsBaby
entity tag for zoglins cannot be changed from true to false (or 1b to 0b) with /data
.
Can confirm in 21w07a. Here are some steps to reproduce this issue:
To reproduce:
Summon a baby zoglin
/summon zoglin ~ ~ ~ {IsBaby:1b}
Run the
/data
command:/data merge entity @e[type=zoglin,limit=1,sort=nearest] {IsBaby:0b}
→ ❌ "Modified entity data of Zoglin" is shown in chat but the mob still remains as a zoglin piglet.
Linked issues
is duplicated by 1
relates to 1
Attachments
Comments 11
Can confirm in 21w07a. Here are some steps to reproduce this issue:
Steps to Reproduce:
Summon a zoglin using a spawn egg.
Run the following command to convert the zoglin into a baby:
/data merge entity @e[type=zoglin,limit=1,sort=nearest] {IsBaby:1b}
→ ✔ Notice how the zoglin is now a baby.
Run the following command to convert the zoglin back into an adult:
/data merge entity @e[type=zoglin,limit=1,sort=nearest] {IsBaby:0b}
→ ❌ Notice how this does not work.
I can confirm this issue in Minecraft 1.21 pre-release 1.
Code analysis (Yarn mappings)
The following code in the ZoglinEntity
class manages the babiness of zoglins:
@Override
public void writeCustomDataToNbt(NbtCompound nbt) {
super.writeCustomDataToNbt(nbt);
if (this.isBaby()) {
nbt.putBoolean("IsBaby", true);
}
}
@Override
public void readCustomDataFromNbt(NbtCompound nbt) {
super.readCustomDataFromNbt(nbt);
if (nbt.getBoolean("IsBaby")) {
this.setBaby(true);
}
}
Notice that the zoglin becomes a baby if the IsBaby
field within entity NBT is true. There is no behavior for making the zoglin not a baby if the IsBaby
field is false.
Compare to the same methods in other entities with a boolean babiness status (zombies and piglins), where the IsBaby
field controls babiness regardless of being true or false:
@Override
public void readCustomDataFromNbt(NbtCompound nbt) {
super.readCustomDataFromNbt(nbt);
this.setBaby(nbt.getBoolean("IsBaby"));
}
Can confirm in 21w03a.