A variant block is a block that can have multiple geometries based on the surrounding blocks.
More...
#include <VariantBlock.h>
|
|
| VariantBlock (BlockID id, Layer layer, const Geometry *baseGeo, RotationMode rotationMode, int variantCount) |
| |
|
VariantBlock & | allowMultiple (bool allowMultiple) |
| |
|
bool | allowMultiple () const |
| |
|
VariantBlock & | alwaysUseBaseGeometry (bool alwaysUseBaseGeometry) |
| |
|
bool | alwaysUseBaseGeometry () const |
| |
|
VariantBlock & | addVariant (const Geometry &geometry, std::initializer_list< Condition > conditions) |
| |
|
VariantBlock & | addVariant (Variant &&variant) |
| |
| const Variant * | getVariant (const Neighbours &neighbours) const |
| | Get a variant that matches the neighbours.
|
| |
| std::vector< const Variant * > | getVariants (const Neighbours &neighbours) const |
| | Get all variants that match the neighbours.
|
| |
| std::vector< const Geometry * > | getGeometries (const Neighbours &neighbours) const |
| | Get all geometries that match the neighbours and the base geometry if alwaysUseBaseGeometry is true.
|
| |
|
| Block (BlockID id, Layer layer, const Geometry *geo) |
| |
|
| Block (BlockID id, Layer layer, const Geometry *geo, RotationMode rotationMode) |
| |
|
virtual bool | onInteract (InteractContext *context) const |
| |
|
virtual void | onDestroyed (const BlockSetContext &context) const |
| |
|
virtual void | onPlaced (const BlockSetContext &context) const |
| |
|
bool | isAir () const |
| |
|
bool | isMultiblock () const |
| |
|
BlockID | getID () const |
| |
|
const Geometry * | geometry () const |
| |
|
bool | isSolid () const |
| |
|
bool | isVoxel () const |
| |
|
bool | facingUp () const |
| |
|
Layer | layer () const |
| |
|
RotationMode | rotationMode () const |
| |
|
Block & | rotationMode (RotationMode mode) |
| |
|
Block & | isSolid (bool solid) |
| |
|
Block & | isVoxel (bool voxel) |
| |
| Block & | facingUp (bool state) |
| |
|
Block & | material (const BlockMaterial &mat) |
| |
|
const BlockMaterial & | material () const |
| |
|
| static constexpr BlockID | AirID = 0 |
| | Reserved block ID range: 0-8 (inclusive).
|
| |
|
static constexpr BlockID | MultiblockID = 1 |
| |
|
bool | m_isSolid |
| |
|
bool | m_isVoxel |
| |
|
bool | m_faceUp = false |
| |
|
Layer | m_layer |
| |
|
RotationMode | m_rotationMode = RotationMode::None |
| |
|
const Geometry * | m_geometry |
| |
|
BlockMaterial | m_material |
| |
A variant block is a block that can have multiple geometries based on the surrounding blocks.
- Note
- The block is always using the base geometry if no variant is found.
-
The block can be configured to always use the base geometry even if a variant is found.
-
The block can be configured to allow multiple variants (thus geometries) to be used at the same time.
-
If
◆ getGeometries()
| std::vector< const Geometry * > VariantBlock::getGeometries |
( |
const Neighbours & |
neighbours | ) |
const |
Get all geometries that match the neighbours and the base geometry if alwaysUseBaseGeometry is true.
- Parameters
-
| neighbours | The neighbours of the block. |
- Returns
- All geometries that match the neighbours and the base geometry if alwaysUseBaseGeometry is true.
◆ getVariant()
Get a variant that matches the neighbours.
- Parameters
-
| neighbours | The neighbours of the block. |
- Returns
- The variant that matches the neighbours.
- Note
- Should be used if allowMultiple is false.
◆ getVariants()
Get all variants that match the neighbours.
- Parameters
-
| neighbours | The neighbours of the block. |
- Returns
- All variants that match the neighbours.
- Note
- Should be used if allowMultiple is true.
◆ isValidRotationMode()
| static constexpr bool engine::VariantBlock::isValidRotationMode |
( |
RotationMode |
mode | ) |
|
|
inlinestaticconstexpr |
The documentation for this class was generated from the following files: