Changing Tool Names

Discussion in 'Mod Development' started by Wavebrother, Jan 12, 2015.

  1. Wavebrother

    Wavebrother New Member

    I would like to change the name and texture of my tool when it gets a certain enchantment. For example, I would like to change the name to "Silky Ender Pickaxe" when it gets silk touch. Anyone know how I would do this?
  2. ljfa

    ljfa New Member

    Should be possible by overriding the getUnlocalizedName function. It takes an ItemStack as parameter so you can look at its NBT data and act accordingly.
    And you can do the same thing for the texture with getIcon.
  3. Wavebrother

    Wavebrother New Member

  4. VapourDrive

    VapourDrive New Member

    I would be wary about changing the unlocalised name, not a great idea. I would recommend using getItemStackDisplayName - also uses an itemstack as the parameter and only changes the on screen name that the player sees. The "identity" of the item changes with the unlocalised name and you may not want that. Also if you change the display name and still want to keep it localized (which is good) you need to manually set up the localization.
  5. ljfa

    ljfa New Member

    Oh good to know! Thanks!
  6. Elder Jürd

    Elder Jürd New Member

    Also... you could add the adjective as a tooltip looking like:

    Ender pickaxe
    That's pretty neat.

Share This Page