Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Member Functions | Protected Attributes | List of all members
cPieceModifierRandomizeBlocks Class Reference

A modifier which is pseudo-randomly replacing blocks to other types and metas. More...

Inheritance diagram for cPieceModifierRandomizeBlocks:
Inheritance graph
[legend]
Collaboration diagram for cPieceModifierRandomizeBlocks:
Collaboration graph
[legend]

Public Member Functions

virtual void AssignSeed (int a_Seed) override
 Called when the piece pool is assigned to a generator, so that the modifiers can access world seed. More...
 
 cPieceModifierRandomizeBlocks (void)
 
virtual bool InitializeFromString (const AString &a_Params, bool a_LogWarnings) override
 Initializes the modifier's parameters from the string representation. More...
 
virtual void Modify (cBlockArea &a_Image, const Vector3i a_PiecePos, const int a_PieceRot) override
 Called prior to writing piece to a chunk, so that modifiers can modify blocks in the blockarea. More...
 
bool ParseMeta (const AString &a_Meta, std::array< int, 4 > &a_ParsedMeta, bool a_LogWarnings)
 
- Public Member Functions inherited from cPiece::cPieceModifier
virtual ~cPieceModifier ()
 

Protected Attributes

int m_AllWeights = 0
 
cRandomizedBlocks m_BlocksToRandomize
 Randomized blocks with their weights and meta params. More...
 
std::map< BLOCKTYPE, int > m_BlocksToReplace
 Block types of a blocks which are being replaced by this strategy. More...
 
int m_MaxMeta = -1
 Maximum meta to randomize. More...
 
int m_MaxNoiseMeta = 0
 Maximum meta in noise range. More...
 
int m_MinMeta = 0
 Minimum meta to randomize. More...
 
int m_MinNoiseMeta = 0
 Minimum meta in noise range. More...
 
int m_Seed
 

Detailed Description

A modifier which is pseudo-randomly replacing blocks to other types and metas.

Definition at line 21 of file PieceModifier.cpp.

Constructor & Destructor Documentation

◆ cPieceModifierRandomizeBlocks()

cPieceModifierRandomizeBlocks::cPieceModifierRandomizeBlocks ( void  )
inline

Definition at line 25 of file PieceModifier.cpp.

Member Function Documentation

◆ AssignSeed()

virtual void cPieceModifierRandomizeBlocks::AssignSeed ( int  a_Seed)
inlineoverridevirtual

Called when the piece pool is assigned to a generator, so that the modifiers can access world seed.

Reimplemented from cPiece::cPieceModifier.

Definition at line 280 of file PieceModifier.cpp.

◆ InitializeFromString()

virtual bool cPieceModifierRandomizeBlocks::InitializeFromString ( const AString a_Params,
bool  a_LogWarnings 
)
inlineoverridevirtual

Initializes the modifier's parameters from the string representation.

a_Params is the string containing only the parameters If a_LogWarnings is true, logs any problems to the console. Returns true if successful, false if the string parsing failed. Used when loading the modifier from a file.

BlocksToReplace parsing

Meta params parsing

Implements cPiece::cPieceModifier.

Definition at line 30 of file PieceModifier.cpp.

◆ Modify()

virtual void cPieceModifierRandomizeBlocks::Modify ( cBlockArea a_Image,
const Vector3i  a_PiecePos,
const int  a_PieceNumRotations 
)
inlineoverridevirtual

Called prior to writing piece to a chunk, so that modifiers can modify blocks in the blockarea.

Implements cPiece::cPieceModifier.

Definition at line 227 of file PieceModifier.cpp.

◆ ParseMeta()

bool cPieceModifierRandomizeBlocks::ParseMeta ( const AString a_Meta,
std::array< int, 4 > &  a_ParsedMeta,
bool  a_LogWarnings 
)
inline

Definition at line 181 of file PieceModifier.cpp.

Member Data Documentation

◆ m_AllWeights

int cPieceModifierRandomizeBlocks::m_AllWeights = 0
protected

Definition at line 286 of file PieceModifier.cpp.

◆ m_BlocksToRandomize

cRandomizedBlocks cPieceModifierRandomizeBlocks::m_BlocksToRandomize
protected

Randomized blocks with their weights and meta params.

Definition at line 293 of file PieceModifier.cpp.

◆ m_BlocksToReplace

std::map<BLOCKTYPE, int> cPieceModifierRandomizeBlocks::m_BlocksToReplace
protected

Block types of a blocks which are being replaced by this strategy.

Definition at line 290 of file PieceModifier.cpp.

◆ m_MaxMeta

int cPieceModifierRandomizeBlocks::m_MaxMeta = -1
protected

Maximum meta to randomize.

Definition at line 299 of file PieceModifier.cpp.

◆ m_MaxNoiseMeta

int cPieceModifierRandomizeBlocks::m_MaxNoiseMeta = 0
protected

Maximum meta in noise range.

Definition at line 302 of file PieceModifier.cpp.

◆ m_MinMeta

int cPieceModifierRandomizeBlocks::m_MinMeta = 0
protected

Minimum meta to randomize.

Definition at line 296 of file PieceModifier.cpp.

◆ m_MinNoiseMeta

int cPieceModifierRandomizeBlocks::m_MinNoiseMeta = 0
protected

Minimum meta in noise range.

Definition at line 305 of file PieceModifier.cpp.

◆ m_Seed

int cPieceModifierRandomizeBlocks::m_Seed
protected

Definition at line 285 of file PieceModifier.cpp.


The documentation for this class was generated from the following file: