How can you rename an item with Java?

im
- in Plugins
7

I wanted to write a new plugin in which existing items in Minecraft should get new names.

e.g. Dirt -> pile of dirt

I don't need any code just an explanation of how to do it.

But wouldn't mind code if someone is too boring.

Ru

As far as I know you have to rename the file in the resource pack and that's enough.

im

Thank you very much

Dr

In the ItemMeta (ItemStack # getItemMeta) you can set a name with setDisplayName

im

Ah okay that works with normal items too. So I thought you have to create a new item.

Dr

That works with every item.

Also existing.

You only need the ItemStack object

Dr

E.g. Can you get an ItemStack object through Player # getIemInMainHand or Inventory # getItem

im

Thank you so much!

Have a good time