BlockState .with() .get() custom data


Can the .with() and .get() methods on block states cause them to hold custom data?
I have an idea to have 3 types of iron ore for a plugin that defines purity, low purity, medium, and high. They look the same, but drop different items, relative to the type of iron ore. How can I implement this?


Short answer: yes
Here’s the sponge docs, there should also be some examples in the cookbook.
finally here’s an example from one of my plugins, storing the block placer in a block.

Edit: see answer below


You cannot store custom data to BlockStates. You can store custom data on TileEntity, Entity, and ItemStack instances. The reason locations aren’t impelemented yet is that it’s difficult to keep track of the custom data for usage all the time, and the possibilities of expanding/exploding world storage sizes is somewhat astronomical to consider.