How to use Data API 2.0

Are there plans to help simplify what developers need to write with custom DataManipulators? Currently, there’s a lot a plugin dev would have to write to get a DataManipulator to work, but I don’t see the point in half of the methods, like from, fill, etc.

Also, maybe, just like events, could it be possible you guys can make data manipulators generated by annotations?

I’m currently in the process of implementing a DataManipulator myself to make sure I understood it correctly. Once I’m finished (probably this weekend) I will work with @Tzk to get a nice contribution page for all the people who want to help with implementing Sponges data manipulators.

Implementing custom data manipulators (-> those not provided by Sponge) is also on my ToDo list, but not as high a priority as helping people to contribute.

As for simplification and generating stuff from annotations, I cannot answer those. You’ll have to wait for @gabizou to drop by.

5 Likes

@Saladoc
Any update on that contribution page? Is it out? (and/or is there a page that talks about implementing custom DataManipulatos).

Also, question: All Data is persistent, yes? As in, if I create a custom data manipulator and all that and add data to a DataContainer, does that DataContainer save its data even if the server reboots? (I would assume so, considering thats what Data is for, but would this also work for a custom data manipulator?)

Note the naming difference of DataContainer and DataHolder. DataContainer is the functional equivalent of NBTTagCompound, whereas DataHolder can retrieve DataManipulators and Values.

To actually answer your question:

It’s still being worked on, I’m giving it a look over this week as there’s some things that are a little wonky.

In short, yes. As long as custom DataManipulators have registered all their required supporting objects (DataManipulatorBuilders, ImmutableDataManipulator equivalent, etc.), but it will only work (For now) on Entities, TileEntities, and ItemStacks.

1 Like

Thanks for your answer! I understand its being worked on, I just wish it was going faster. Pity developers actually have like, lives and stuff…

You can view a preview of the unfinished PR there:

Note that it’s still WIP and may still contain errors and typos.
There’s an issue about Data progress too:

Thanks, ill be sure to check it out