@CatalogedBy(value=BlockTypes.class) public interface BlockType extends CatalogType, Translatable, PropertyHolder
Blocks are further differentiated using a BlockState
. Complex
data, such as inventory contents, are considered data, which is provided
via DataHolder
.
Modifier and Type | Method and Description |
---|---|
Collection<BlockState> |
getAllBlockStates()
|
BlockState |
getDefaultState()
Return the default state for this block.
|
Optional<ItemType> |
getItem()
Return the
ItemType that represents this block. |
String |
getName()
Return the internal ID for the block.
|
BlockSoundGroup |
getSoundGroup()
Gets the
BlockSoundGroup for this block. |
boolean |
getTickRandomly()
Gets if this BlockType is set to receive random block ticks.
|
Optional<BlockTrait<?>> |
getTrait(String blockTrait)
Attempts to retrieve the
BlockTrait instance associated with
this BlockState s BlockType by string id. |
Collection<BlockTrait<?>> |
getTraits()
|
void |
setTickRandomly(boolean tickRandomly)
Sets if the BlockType should receive random block ticks.
|
getId
getTranslation
getApplicableProperties, getProperty
String getName()
The format of the internal ID may vary between implementations
but in Minecraft, it follows the format of domain:type
, an
example being minecraft:stone
.
getName
in interface CatalogType
BlockState getDefaultState()
Collection<BlockState> getAllBlockStates()
Optional<ItemType> getItem()
ItemType
that represents this block.Optional.empty()
otherwiseboolean getTickRandomly()
Random block ticks are most commonly used for growth of plants.
void setTickRandomly(boolean tickRandomly)
Random block ticks are most commonly used for growth of plants.
tickRandomly
- If the BlockType should tick randomly.Collection<BlockTrait<?>> getTraits()
Optional<BlockTrait<?>> getTrait(String blockTrait)
BlockTrait
instance associated with
this BlockState
s BlockType
by string id. If there is no
BlockTrait
available, Optional.empty()
is returned.blockTrait
- The block trait idBlockSoundGroup getSoundGroup()
BlockSoundGroup
for this block.