Extending ItemMeta

Discussion in 'Plugin Development' started by NathanWolf, Dec 3, 2013.

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

    NathanWolf

    Hello!
    First off, I hope this is the right forum.

    I'd really like to propose an addition to the Bukkit API- this isn't a bug, but I feature I'd love to add (or see added)- is Leaky still the right place for that?

    Before I make an official request, I also just wanted to see if anyone else thought this was a good idea.

    I would like to extend the ItemMeta interface to allow arbitrary NBT access (through a Bukkit API, of course). What I am specifically thinking of would look very similar to the Configuration API, and my hope would be there's some room for crossover. If not, then basically the same idea- I want to be able to get/set values, including lists.

    I think there is some fear (?) of letting devs have access to the raw tags- but IMO giving an API (that could be limited somehow if necessary) will prevent devs from having to abuse the API (via reflection, direct CB linking, or whatever) because we know people are going to do it anyway.

    So mainly I'm wondering if this is being avoided out of fear of breaking clients or what.

    I know for me, personally, being able to store custom NBT data in an officially supported way would be tremendous. I'd love the same ability on entities while we're at it, but I figured I'd start small (and with something I have personal experience with). I also think a similar approach for entities would be a much better and more useful mechanism that the existing player metadata system (that's non-persisent).

    Thanks for reading!
     
  2. Offline

    The_Doctor_123

    I completely agree. Will they add it? No. I'm sure they're quite aware developers would love this, but for some reason, they won't implement an API for that. And I've learned that you really can't change people's minds around these parts.
     
  3. Offline

    NathanWolf

    Do you know if there's a resistance beyond not wanting to do the work? Is there fear of abuse or something?
     
  4. Offline

    The_Doctor_123

    NathanWolf
    No, not really.. I just believe they'd be stubborn. I'd have to imagine that someone already requested this and has been denied.
     
  5. Offline

    NathanWolf

    I'm sure a lot of people have requested it- but I'm wondering if anyone has requested permission to do the work.

    I've had some... negative experiences with this before (re: the stubborness you speak of) so I don't want go off and do a bunch of work if there's no way it'd ever get accepted.

    I guess I should take this to Leaky or something...
     
  6. Offline

    The_Doctor_123

    NathanWolf
    Well, I would certainly ask before you create this class, unless you'd like to just keep the class to yourself anyway.
     
  7. Offline

    NathanWolf

    Well it's more than that, unfortunately. It's not so much that I want an API- personally I'm ok with using my own hacky reflection-based class, it gets the job done.

    The problem I'm trying to solve is that Bukkit itself (the code, not necessarily the team) does not make any effort at all to preserve non-standard metadata on items. In fact, when I pried about this a little, I learned that the ItemStack method that does preserve the actual MC data (EDIT: asCraftMirror ... or maybe it was asNMSCopy... I dunno) is being phased out in favor of asBukkitCopy, which only copies the metadata that Bukkit itself cares about.

    So my main goal in this would be to extend Bukkit's concept of an ItemStack to cover an arbitrary tree of metadata that it would preserve when making copies.

    Otherwise, no matter what fancy tricks I do, there's always the possibility that Bukkit will just blow away whatever data I've set up, and this is (frustratingly) intentional behavior. I've been able to skate by jumping through a few hoops (e.g. canceling the incredibly flaky inventory drag event) but I wonder how long that's going to last.

    At this point my plugin is completely reliant on its custom NBT data- if a wand loses its tags, it's just a shiny blaze rod with a lot of meaningless lore... ;(
     
Thread Status:
Not open for further replies.

Share This Page