Beacon block entity contains code for custom names, despite not storing it to NBT and the beacon GUI not having one
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
2018-01-18, 04:16 AM
2018-10-03, 09:58 AM
2018-10-03, 09:58 AM
5
4