Custom Items with the BukkitAPI (or external API)

Discussion in 'Plugin Development' started by Matthiaantje, Sep 7, 2016.

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

    Matthiaantje

    Hay everyone!
    Today I've a really peculiar question...
    I searched the internet for it for about 5 hours total but I can't find anything useful,
    my problem is:

    How to create a custom item in Bukkit (like a blueberry or something...)
    I don't want to use a selfmade resourcepack cause I need the items in the default texture pack...

    Is there an external Library I can use?
    IS THIS EVEN POSSIBLE!?

    please answer this ASAP, really need this!
     
  2. Offline

    AlvinB

    @Matthiaantje
    No, you cannot make custom item textures without a custom resource pack.
     
  3. Offline

    Matthiaantje

    aaaaand, can you ADD extra items to a resourcepack?
    (I think i know the answer already, but, let's give it a shot)
     
  4. Offline

    AlvinB

    @Matthiaantje
    No, you can only retexture items. There are however some clever approaches to only retexture items with a certain data value.
     
  5. Offline

    Zombie_Striker

    Last edited: Sep 7, 2016
  6. Offline

    ZP18

  7. Offline

    Rayzr522

    @Matthiaantje @AlvinB @Zombie_Striker @ZP18
    I come bearing overly complicated gifts! er–solutions!

    SO. On to business: You know the little durability bar on items? You know how when it's low enough it no longer shows any red, it's just empty? Like this:
    item.png

    WELL. This number varies, but for diamond tools it stays at that state for 61 uses. Why does this matter at all?

    Basically, my idea is that instead of having a tool break when it gets to 0 durability, have it break when it gets to the point that there's no more red in the durability bar (if that makes sense). This leaves you with 61 unused durabilities, and that's only one tool! Just counting the 5 diamond tools (sword, pickaxe, axe, shovel and hoe), that's 305 possible custom item textures. Now Mojang made this hard for us because to get the proper model for the proper durability you have to use a decimal value. This is hard, but not impossible, although it is annoying since you have to use EXCEEDINGLY precise numbers (Example from a test I was doing: 0.960159).

    This is all theoretical, but between all the tools in Minecraft you could have I'm guessing at least 1000 custom item textures. I'm too lazy to do the actual math though, since the amount of "useable" durabilities is different for the different items.

    Hopefully this helps you all out! There are also ways to enforce the use of the server resource pack using packet listeners. If they refuse to use the resource pack then just kick 'em (although there are probably better things to do then just kicking them immediately).

    EDIT 2: I'd appreciate any feedback since I just sunk about 45 minutes into this :p

    EDIT: So @ZP18 the point is you CAN use vanilla tools without breaking them, it just changes how durability works a *little*, and means your tools have a tiny bit less durability. Of course if you only need 5 custom items you could even just take 1 of the durability from 5 items so that it barely affected the game at all.
     
    Last edited: Sep 8, 2016
  8. Offline

    Mindlessmink

  9. Offline

    Rayzr522

    Big wall o' text XD

    But seriously, just gotta figure a few things out and then modpacks made with Bukkit could be a reality. Goodbye laggy Forge, hello no-lag modpack that doesn't require the user to download anything (EDIT: except for a resource pack, but that is actually sent from the server unlike mods... sounds like GMod to me :p)
     
  10. Offline

    Zombie_Striker

    @Rayzr522
    I have a question: Why are you smaller values for diamond tools when you could use larger ones for random objects (like slimeballs). If you set that t o 2.00, that should mean that a slime ball with durability "1" should be set to a new texture.
     
  11. Offline

    Rayzr522

    I'm almost certain it only works on tools. Otherwise the "durability", which is from 0 to 1, would have no scale for reference. (e.g. the scale for an iron pickaxe is between 0 and 250 so the value is mapped from 0 to 1 to the proper durability, 0 to 250)

    Oh, and values greater than 1.00 don't do squat.

    EDIT: Wait... I'm still understanding you wrong...

    EDIT 2: No, the durability is how broken it is. So 1.00 is fully broken, 0.00 is not broken at all. 2.00 would be negative durability values, but I already tested that. It doesn't work.

    EDIT 3: So 0.960159 is right when the durability bar on a diamond tool goes to empty, a.k.a 61 uses left.
     
  12. Offline

    Matthiaantje


    Whauw, that's really...smart :)
     
    Last edited by a moderator: Sep 10, 2016
  13. Offline

    Rayzr522

    Haha thanks :D

    It was just a moment of inspiration. It would be difficult to implement though, and for it to even be plausible the only way I could think of doing it is generating a resource pack at runtime, but that would be.... difficult. You'd have to generate the resource pack, and then host a web server through the plugin so that it could be sent to players. Difficult to say the least.

    EDIT: But I'm doing some research into that, it is theoretically possible. Just difficult.
     
  14. Offline

    ZP18

    If somebody can manage to implement this mentality it would actually open up so many opportunities


    Sent from my iPhone using Tapatalk
     
  15. Offline

    Rayzr522

    Well there's multiple problems we'd have to overcome:
    1. Preventing default item behavior. You can make a pickaxe look like anything, but it's still a pickaxe.
    2. Assignment of IDs to the various unused damage values.
    3. Resource pack generation.
    4. Running a web server for the client to receive the resource pack from.
    5. Making a framework for all this. Even just trying to make 3 custom items with this system would be exceedingly difficult without a good framework to work with. How I would do this is essentially recreate the Forge system, or something like it. You'd of course be a little more limited, but it would make the most sense.
     
  16. Offline

    Matthiaantje

    There has to be a way to GET the texture of the item and then CLONE the OBJECT of the item, and paste a new texture on to it, one problem then: you can only use textures wich have the same values (x, y, z) as the original... cause the object is unchanged
     
  17. Offline

    ZP18

    I never said it would be easy, what do you mean about the IDs?


    Sent from my iPhone using Tapatalk
     
  18. Offline

    Rayzr522

    You'd have to create an ID system for registering the custom items to different durabilities of the tools.
     
Thread Status:
Not open for further replies.

Share This Page