pub trait Block: Debug + Any {
// Required methods
fn behavior(&self) -> BlockBehavior;
fn id(&self) -> &'static str;
fn as_block_state(&self) -> BlockState;
fn as_registry_block(&self) -> Block;
}
Required Methods§
fn behavior(&self) -> BlockBehavior
Sourcefn id(&self) -> &'static str
fn id(&self) -> &'static str
Get the Minecraft ID for this block. For example stone
or
grass_block
.
Sourcefn as_block_state(&self) -> BlockState
fn as_block_state(&self) -> BlockState
Convert the block to a block state. This is lossless, as the block contains all the state data.
Sourcefn as_registry_block(&self) -> Block
fn as_registry_block(&self) -> Block
Convert the block to an azalea_registry::Block
. This is lossy, as
azalea_registry::Block
doesn’t contain any state data.
Implementations§
Trait Implementations§
Source§impl From<BlockState> for Box<dyn Block>
impl From<BlockState> for Box<dyn Block>
Source§fn from(block_state: BlockState) -> Self
fn from(block_state: BlockState) -> Self
Converts to this type from the input type.