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

Player head NBT "ExtraType" is no longer saved but doesn't use DataFixerUpper upgrade path

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 24w10a
    • 1.16.5
    • None
    • Confirmed
    • Commands, Datafixer

      The NBT ExtraType can be used to set a player head's owner without specifying a profile. It was the only way to specify a skull owner before player UUIDs were added (1.7 and below).

      However, when loaded into Minecraft it is immediately replaced by the new SkullOwner tag. This suggests that this is an old upgrade path that doesn't use DataFixerUpper.

      This causes issues like MC-164298, where ExtraType is technically still valid, but cannot be saved to NBT, and causes confusion because it only exists on the block entity.

      Code analysis

      Mojang mappings, 1.16.5 fabric.

      SkullBlockEntity.java
      public void load(BlockState blockState, CompoundTag compoundTag) {
          super.load(blockState, compoundTag);
          if (compoundTag.contains("SkullOwner", 10)) {
              this.setOwner(NbtUtils.readGameProfile(compoundTag.getCompound("SkullOwner")));
          } else if (compoundTag.contains("ExtraType", 8)) {
              String string = compoundTag.getString("ExtraType");
              if (!StringUtil.isNullOrEmpty(string)) {
                  this.setOwner(new GameProfile((UUID)null, string));
              }
          }
      }
      

      This means that when an NBT ExtraType appears, it's immediately converted into a GameProfile.

      This is the only location where the string ExtraType appears. In the save() method, it only puts the NBT SkullOwner.

      This suggests that this is supposed to be an upgrade path, which is in the middle of the skull code instead of in net.minecraft.util.datafix.fixes.

            Unassigned Unassigned
            violine1101 [Mod] violine1101
            Votes:
            5 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: