mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-02 22:06:05 +00:00
Extended BlockState API
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
package com.dfsek.terra.api.block;
|
||||
|
||||
import com.dfsek.terra.api.Handle;
|
||||
|
||||
|
||||
public interface BlockData extends Handle {
|
||||
String toString();
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
|
||||
@@ -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;}
|
||||
}
|
||||
Reference in New Issue
Block a user