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

Beacon block entity contains code for custom names, despite not storing it to NBT and the beacon GUI not having one

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: Minecraft 1.12.2, Minecraft 18w03b, Minecraft 18w06a, Minecraft 18w20c, Minecraft 1.13-pre3, Minecraft 1.13-pre7, Minecraft 1.13-pre10, Minecraft 1.13, Minecraft 18w30a, Minecraft 18w31a, Minecraft 1.13.1
    • Fix Version/s: Minecraft 18w43a
    • Labels:
    • Confirmation Status:
      Confirmed

      Description

      Beacons have code for custom names, but the GUI doesn't render the name and the custom name isn't saved to NBT

      The bug

      Beacons have code to store a display name (all information based off of MCP 940):

      BlockBeacon
          /**
           * Called by ItemBlocks after a block is set in the world, to allow post-place logic
           */
          public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
              super.onBlockPlacedBy(worldIn, pos, state, placer, stack);
      
              if (stack.hasDisplayName()) {
                  TileEntity tileentity = worldIn.getTileEntity(pos);
      
                  if (tileentity instanceof TileEntityBeacon) {
                      ((TileEntityBeacon)tileentity).setName(stack.getDisplayName());
                  }
              }
          }
      

      There also is a custom name field in the block entity (customName), but it is never saved or loaded:

          public void readFromNBT(NBTTagCompound compound) {
              super.readFromNBT(compound);
              this.primaryEffect = isBeaconEffect(compound.getInteger("Primary"));
              this.secondaryEffect = isBeaconEffect(compound.getInteger("Secondary"));
              this.levels = compound.getInteger("Levels");
          }
      
          public NBTTagCompound writeToNBT(NBTTagCompound compound) {
              super.writeToNBT(compound);
              compound.setInteger("Primary", Potion.getIdFromPotion(this.primaryEffect));
              compound.setInteger("Secondary", Potion.getIdFromPotion(this.secondaryEffect));
              compound.setInteger("Levels", this.levels);
              return compound;
          }
      

      Since there is code to set the custom name when placing a block, and fields to actually store that name, it seems likely that it was intended for the name to be visible. However, the actual beacon GUI doesn't display it.

      Possible fixes

      • Add code to render the beacon display name in the GUI and store the custom name field

      OR

      • Remove the currently unused code for the custom names

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                boq [Mojang] Bartosz Bok
                Reporter:
                pokechu22 [Mod] Pokechu22
              • Votes:
                5 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  CHK: