Bad spigot API for spawn eggs in 1.9?

Discussion in 'Spigot Plugin Development' started by dumbninja22, May 26, 2016.

  1. I'll start off with this:

    [​IMG]

    So obviously they messed things up in 1.9. And now, there is a VERY bad API for the spawn eggs.

    I have an itemstack. Somehow, there is spawn egg data in it (that I got from SpawnEgg()). What If I add a lore to the item? Spawn egg data disappears. If I add a display name or change the ItemStack in whatever way, the entire spawn egg data disappears leaving me a blank white egg ItemStack that doesn't do anything useful. If I try to recreate the itemstack in any way, spawn egg data will disappear and I can't add it back in directly or easily.

    I can't add an "EntityTag" like in vanilla. It's very restrictive, I can't do anything good with spawn eggs in 1.9.

    I think that the old way of doing the spawn egg (with the durability-style data) was much better.

    And now I must ask the questions: how can I handle spawn eggs reliably? How do I add a lore to spawn eggs? How do I convert an itemstack to a spawn egg?

    What is Spigot's plan when it comes to this?
     
  2. Choco

    Moderator

    I'm just sitting and hoping that someone can PR a proper API implementation for this new change. That would be really quite helpful :)
     
  3. There's one being worked on, but since it's in the form of ItemMeta it needs to be configuration serializable. Entities don't go well with that :/
     
    • Informative Informative x 1
  4. Yep

    :(

    Also I discovered that all the reflection methods linked to me earlier are pretty much the same as something like:

    SpawnEgg se = (SpawnEgg) itemstack.getData()
     
  5. Not at all, it sets NBT data without touching NMS, also reflection really isn't that bad once you understand it

    Sent from my SGH-I747M using Tapatalk
     
  6.  
    • Like Like x 1
  7. What does PR stands for?
     
  8. Pull Request I think
     
    • Agree Agree x 2
    • Like Like x 1
    • Winner Winner x 1
  9. Thats why we use reflection, if you just imported the server jar then you'd need to update the code giving you spawn eggs every update.

    Sent from my SGH-I747M using Tapatalk
     
  10. sothatsit

    Patron

    It was mojang that made the change to spawn eggs, so you cannot blame Spigot, nor can you expect immediate support for spawn eggs in 1.9 as they are only used in a small number of cases.

    But yes, i agree that it is annoying and i always thought spigot should support nbt data already.
     
  11. What do you think ItemMeta is? It's the implementation of NBT data for ItemStacks

    Sent from my SGH-I747M using Tapatalk
     
  12. sothatsit

    Patron

    ItemMeta is far far more restrictive than having access directly to the NBT data.
     
  13. While I agree that ItemMeta should have something like a setRaw method for raw NBT data, its all we've got atm

    Sent from my SGH-I747M using Tapatalk
     
  14. sothatsit

    Patron

    Yes, it is all we have, i don't know what your trying to say with your post, you are pretty much just parroting what i have already said.
     
  15. But isn't NBT just a data format and as such implementation specific?

    If the mappings were updated, reflection fails gracefully and you do need to update on every update. With the difference that this process will be by far more annoying.
     
  16. sothatsit

    Patron

    NBT Data is client side implementation specific, so it only breaks if mojang changes it, so its not really "implementation specific" for the server.
     
    #18 sothatsit, May 27, 2016
    Last edited: May 27, 2016
  17. Choco

    Moderator

    Contradiction FTW :D
     
  18. sothatsit

    Patron

    Eh, clarified it for you dumby. My point is that it's not going to change very often.
     
    • Winner Winner x 1