The Future of Blocks - Like Bukkit or Not?

I will start by saying yes, I know Sponge isn’t trying to be like Bukkit, don’t try and tell me that. I’ve read it more than enough. -_-

With the Bukkit API, there was a package, org.bukkit.block that contained interfaces for many special types of blocks that had varying attributes to them. For example, org.bukkit.block.Sign was an interface for signs that allowed one to get the text on each line, among other things, and inherited everything from the base Block.

In its current state, the Sponge API does not really have anything that would let me grab lines of text from a sign, or at least it does not appear that it does. So my question is, if I am just blind, where should I turn my head and look? And if I am right in that there is no point to access block specific data such as sign text, will this be a thing eventually?

What you’re looking for is block data. There was a proposal (#236) that used as an example: block.getData(Sign.class).get().setLines(newLines);
Though it was closed with no clear solution.

However, the persistance API, #272, may be of interest and hopefully there will be some easy way to utilize it.

At the moment, the data that can be manipulated is using BlockState by changing values of it’s properties (what used to be metadata) but I do not know how to use it at the moment.

That raises another question - how is getData(), which is expecting a class, supposed to be used if none of the blocks ever exist as classes in the API?

Edit: Found that BlockTypes.WALL_SIGN.getClass() is a thing, but this just brings up a generic BlockType object. So what would I do with that?

I’m thinking the class may be some sort of DataContainer from the persistance API, but I don’t know how it will all work in the end.
However I would expect a core feature like this to be designed well and not just left out.

I think the BlockState class is the solution:

Maybe it will work like this:


Although there is no BlockProperty.StringProperty for sign texts.

Sign text is not stored in the blockstate but in the tile entity of the sign.