Extended BlockState API

This commit is contained in:
Zoë Gidiere
2025-10-05 16:47:12 -06:00
parent 874ef56025
commit 42f3c56b71
3 changed files with 48 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
package com.dfsek.terra.api.block;
import com.dfsek.terra.api.Handle;
public interface BlockData extends Handle {
String toString();
}

View File

@@ -115,4 +115,12 @@ public interface BlockState extends Handle {
* @return Whether this state is air
*/
boolean isAir();
/**
* Get whether this BlockState is an extended state.
* Extended states are states that contain extra data not normally present in a BlockState.
*
* @return Whether this state is extended.
*/
default boolean isExtended() { return false; }
}

View File

@@ -0,0 +1,32 @@
package com.dfsek.terra.api.block.state;
import com.dfsek.terra.api.block.BlockData;
public interface BlockStateExtended extends BlockState {
/**
* Sets the BlockData.
*
* @param data BlockData to set
*
* @return New BlockStateExtended with the given BlockData
*/
BlockStateExtended setData(BlockData data);
/**
* Gets the BlockData.
*
* @return BlockData of this BlockStateExtended
*/
BlockData getData();
/**
* Gets the BlockState.
*
* @return Raw BlockState of this BlockStateExtended
*/
BlockState getState();
@Override
default boolean isExtended() {return true;}
}