Solved How to get material name??

Discussion in 'Plugin Development' started by Tim_M, Aug 6, 2021.

Thread Status:
Not open for further replies.
  1. Offline

    Tim_M

    Yes, I know that Material.toString() exists. I need to get the IN-GAME names of the items. For example horse armor in Material.toString() returns IRON_BARDING, while it's actually called IRON_HORSE_ARMOR. And here's another example: command blocks return as COMMAND, while it's actually COMMAND_BLOCK. How can I get the "correct" item names without checking and correcting a ton?

    Just fixed it! Marking solved

    Alright the solution is to get the item asNMSCopy(), call the save() method on that and then call the .getString("id") on that.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited: Aug 6, 2021
  2. Offline

    KarimAKL

    As this is a forum where people regularly check for solutions to their problems, it would be preferred if you stated the solution rather than "Just fixed it."
     
Thread Status:
Not open for further replies.

Share This Page