How to set DataManipulators of BlockState?

Hey, let’s say I want to set a block to a specific type of wood for example. How do I construct a BlockState with DataManipulators? I understand how to get default wood with .getDefaultState() on the BlockType of wood, but I’m confused on the rest. Thanks!

I have not tested this, but this is how i have been doing it (if im wrong, please someone correct me)

BlockState state = BlockTypes.PLANKS.getDefaultState();
state.getManipulator(TreeData.class).get().setValue(TreeTypes.OAK);

this in theory will work because your changing the data to the DataManipulator that is attached to that block. You then place the block to apply/update the block. Again this has not be tested by myself, but still. Give it a go

When I do

BlockState state = BlockTypes.PLANKS.getDefaultState();
state.getManipulator(TreeData.class).get().setValue(TreeTypes.OAK);

I get the error that Optional.get() cannot be called on an absent value. The absent value is coming from the state.getManipulator(TreeData.class). Thoughts? @MoseMister

It looks like the plank block type is not yet implemented with its manipulators.
You can see that TreeData is not ticked in this list

I don’t think Treedata. Class has not been implemented yet