Solved How do I create a 100% custom item? (Money/Ingot/Ore)

Discussion in 'Spigot Plugin Development' started by KHaX621, Jul 8, 2021.

  1. Trying to get a currency going, and so far I got the command to get the item, (which is currently and iron ingot), but I need to make a custom item with a custom texture/material and all. I already have the pixel art done, but I can't find any tutorials online. The ones I found were, replace an already existing block, won't work for me, and ones that use other mods, won't work I want to start from "scratch". I've also been digging in the java files but can't find anything that would help.

    TDLR (whatever is written in bold)
     
  2. Barbadosian

    Barbadosian Previously Aaron_Mao

    Well, you are really asking couple questions here

    Q: Making custom item
    A: You can do that through the NBT tag called CustomModelData.

    Q: Make the custom texture
    A: You would need to compile a texture pack on your own apart from the plugin itself. Last time I checked there isn't a way to include a texture in the plugin itself, but please correct me if I am wrong.

    Q: Distribute the texture to players
    A: Well, a texture doesn't do any good if can't be seen by the players. Therefore you either have to tell your players to download and use your texture pack, or you would have to enable server texture pack, which can be configured in server.properties.

    If you want to release it as a public resource, it is indeed not a bad idea to start from scratch. However, if you are just making a plugin for your own server, there are quite a lot of "giants' shoulders" that you can stand on to make your plugin as an addon. Such as ItemsAdder(premium).
     
    • Like Like x 1
  3. Thanks. So there isn't a way to make a completely new custom item? Cause wouldn't the texture pack and all just replace an already existing item?
     
  4. You can prompt players to use a resource pack by configuring it in your server settings (which also has an option to require that users accept it), but also by using a plugin to prompt them programmatically via Player#setResourcePack. If you use the latter, you can enforce its use by listening to PlayerResourcePackStatusEvent and kicking the player when the status is DECLINED and maybe FAILED_TO_DOWNLOAD.
    The resource pack download would have to be hosted somewhere though, hence why #setResourcePack accepts a String URL to the download.

    Not anymore, hence why @Barbadosian mentioned custom model data. You can set an item's custom model data with ItemMeta#setCustomModelData, which is sent to the client so that it can be rendered using that special model data. There's a few resources online that go over creating a resource pack and using custom model data in it. The plugin-side of things is relatively straightforward so long as you're decently familiar with the Spigot API and Java.
     
  5. Barbadosian

    Barbadosian Previously Aaron_Mao

    Yeah second on that latter paragraph, plugin side is really not the headache. IMHO dealing with all those json and UV mapping in the resource wrecks my brain lol.
     
  6. Alrighty Thanks!!!
     
  7. Thanks!