Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-169828

"item" particle does not serialize properly for Area Effect Clouds

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.15.1, 1.15.2 Pre-Release 1, 1.15.2 Pre-release 2, 1.15.2, 20w08a, 1.16 Pre-release 3, 1.16.2, 20w51a, 1.18.1
    • None
    • Confirmed
    • (Unassigned)

      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())
      

            Unassigned Unassigned
            BugReporter90001 Name Surname
            Votes:
            6 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              CHK: