Cuberite
A lightweight, fast and extensible game server for Minecraft
Private Types | Private Member Functions | Static Private Member Functions | List of all members
cIncrementalRedstoneSimulator Class Referencefinal

#include <IncrementalRedstoneSimulator.h>

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

Private Types

using Super = cRedstoneSimulator
 

Private Member Functions

virtual void AddBlock (cChunk &a_Chunk, Vector3i a_Position, BLOCKTYPE a_Block) override
 Called to simulate a new block. More...
 
virtual cRedstoneSimulatorChunkDataCreateChunkData () override
 
void ProcessWorkItem (cChunk &Chunk, cChunk &TickingSource, const Vector3i Position)
 
virtual void SimulateChunk (std::chrono::milliseconds Dt, int ChunkX, int ChunkZ, cChunk *Chunk) override
 
virtual void WakeUp (cChunk &a_Chunk, Vector3i a_Position, BLOCKTYPE a_Block) override
 Called to simulate a single new block, typically as a result of a single block break or change. More...
 
virtual void WakeUp (cChunk &a_Chunk, Vector3i a_Position, Vector3i a_Offset, BLOCKTYPE a_Block) override
 Called to simulate a single block, synthesised by the simulator manager. More...
 

Static Private Member Functions

static bool IsAlwaysTicked (BLOCKTYPE a_Block)
 Returns if a redstone device is always ticked due to influence by its environment. More...
 
static bool IsRedstone (BLOCKTYPE a_Block)
 Returns if a block is any sort of redstone device. More...
 

Additional Inherited Members

- Public Member Functions inherited from cSimulator
 cSimulator (cWorld &a_World)
 
virtual ~cSimulator ()
 
- Static Public Member Functions inherited from cSimulator
static std::array< Vector3i, 5 > GetLinkedOffsets (Vector3i Offset)
 For a given offset from a position, return the offsets that represent the adjacents of the newly offset position, excluding the old position. More...
 
- Static Public Attributes inherited from cSimulator
static constexpr std::array< Vector3i, 6 > AdjacentOffsets
 Contains offsets for direct adjacents of any position. More...
 
- Protected Member Functions inherited from cSimulator
virtual void Simulate (float a_Dt)
 
- Protected Attributes inherited from cSimulator
cWorldm_World
 

Detailed Description

Definition at line 10 of file IncrementalRedstoneSimulator.h.

Member Typedef Documentation

◆ Super

Definition at line 13 of file IncrementalRedstoneSimulator.h.

Member Function Documentation

◆ AddBlock()

void cIncrementalRedstoneSimulator::AddBlock ( cChunk a_Chunk,
Vector3i  a_Position,
BLOCKTYPE  a_Block 
)
overrideprivatevirtual

Called to simulate a new block.

Unlike WakeUp this function will perform minimal checking. It queues the block to be simulated as fast as possible, suitable for area wakeups.

Implements cSimulator.

Definition at line 155 of file IncrementalRedstoneSimulator.cpp.

◆ CreateChunkData()

cRedstoneSimulatorChunkData * cIncrementalRedstoneSimulator::CreateChunkData ( void  )
overrideprivatevirtual

Implements cRedstoneSimulator.

Definition at line 184 of file IncrementalRedstoneSimulator.cpp.

◆ IsAlwaysTicked()

bool cIncrementalRedstoneSimulator::IsAlwaysTicked ( BLOCKTYPE  a_Block)
staticprivate

Returns if a redstone device is always ticked due to influence by its environment.

Definition at line 14 of file IncrementalRedstoneSimulator.cpp.

◆ IsRedstone()

bool cIncrementalRedstoneSimulator::IsRedstone ( BLOCKTYPE  a_Block)
staticprivate

Returns if a block is any sort of redstone device.

Definition at line 33 of file IncrementalRedstoneSimulator.cpp.

◆ ProcessWorkItem()

void cIncrementalRedstoneSimulator::ProcessWorkItem ( cChunk Chunk,
cChunk TickingSource,
const Vector3i  Position 
)
private

Definition at line 98 of file IncrementalRedstoneSimulator.cpp.

◆ SimulateChunk()

void cIncrementalRedstoneSimulator::SimulateChunk ( std::chrono::milliseconds  Dt,
int  ChunkX,
int  ChunkZ,
cChunk Chunk 
)
overrideprivatevirtual

Implements cSimulator.

Definition at line 115 of file IncrementalRedstoneSimulator.cpp.

◆ WakeUp() [1/2]

void cIncrementalRedstoneSimulator::WakeUp ( cChunk a_Chunk,
Vector3i  a_Position,
BLOCKTYPE  a_Block 
)
overrideprivatevirtual

Called to simulate a single new block, typically as a result of a single block break or change.

The simulator implementation may decide to perform additional checks or maintain consistency of internal state before the block is added to the simulate queue.

Reimplemented from cSimulator.

Definition at line 193 of file IncrementalRedstoneSimulator.cpp.

◆ WakeUp() [2/2]

void cIncrementalRedstoneSimulator::WakeUp ( cChunk a_Chunk,
Vector3i  a_Position,
Vector3i  a_Offset,
BLOCKTYPE  a_Block 
)
overrideprivatevirtual

Called to simulate a single block, synthesised by the simulator manager.

The position represents the adjacents of the block that was actually changed, with the offset used given. Simulators may use this information to update additional blocks that were affected by the change, or queue farther, extra-adjacents blocks to be updated. The simulator manager calls this overload after the 3-argument WakeUp.

Reimplemented from cSimulator.

Definition at line 207 of file IncrementalRedstoneSimulator.cpp.


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