When you summon an Area Effect Cloud which displays an "item" particle, the particle returns to the default "entity_effect" particle after relogging.
How to reproduce:
1. Summon an Area Effect Cloud using the following command:
/summon minecraft:area_effect_cloud ~ ~ ~ {Duration:1000,Radius:1.0f,Particle:"minecraft:item minecraft:cooked_chicken"}The Area Effect Cloud will display cooked_chicken particles that would display when you eat a cooked_chicken. However, if you then get the entity data of the Area Effect Cloud using the following command, you will see that the item is no longer specified.
/data get entity @e[type=minecraft:area_effect_cloud,limit=1,sort=nearest] Particle
The command will return: Area Effect Cloud has the following entity data "minecraft:item "
even though you would expect "minecraft:item minecraft:cooked_chicken"
2. Relog. After relogging, the Area Effect Cloud will display its default "entity_effect" particle. This behaviour does not occur with any other particle.
*Code analysis by @intsuc*
https://bugs.mojang.com/browse/MC-169828?focusedCommentId=636817&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-636817
Item names are not serialized because of the incorrect usage of StringBuilder. Item ids are used for its initial capacity.
// net.minecraft.commands.arguments.item.ItemInput
public String serialize() {
StringBuilder builder = new StringBuilder(Registry.ITEM.getId(item));
if (tag != null) {
builder.append(tag);
}
return builder.toString();
}It should be
new StringBuilder(Registry.ITEM.getKey(item).toString())Attachments
Comments 3
Fixed in 22w11a:
public String serialize() {
StringBuilder $$0 = new StringBuilder(this.getItemName());
if (this.tag != null) {
$$0.append(this.tag);
}
return $$0.toString();
}
private String getItemName() {
return this.item.unwrapKey().map(ResourceKey::location).orElseGet(() -> "unknown[" + this.item + "]").toString();
}
Updated commands to confirm in 26.3:
/summon area_effect_cloud ~ ~ ~ {Duration:100000,Radius:1.0f,custom_particle:{type:"minecraft:item",item:"minecraft:cooked_chicken"}}/data get entity @e[type=area_effect_cloud,limit=1] custom_particle
Confirmed for 1.15.2 and 20w08a.
Code analysis
Item names are not serialized because of the incorrect usage of
StringBuilder. Item ids are used for its initial capacity.It should be