Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
cNetherPortalScanner Class Reference

#include <NetherPortalScanner.h>

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

Public Types

enum class  Direction { X , Y }
 

Public Member Functions

 cNetherPortalScanner (cEntity &a_MovingEntity, cWorld &a_DestinationWorld, Vector3d a_DestPosition, int a_MaxY)
 
virtual bool OnAllChunksAvailable (void) override
 Called once all of the contained chunks are available. More...
 
virtual void OnChunkAvailable (int a_ChunkX, int a_ChunkY) override
 Called when a specific chunk become available. More...
 
virtual void OnDisabled (void) override
 Called by the ChunkMap when the ChunkStay is disabled. More...
 
- Public Member Functions inherited from cChunkStay
void Add (int a_ChunkX, int a_ChunkZ)
 Adds a chunk to be locked from unloading. More...
 
 cChunkStay (void)
 
void Clear (void)
 Clears all the chunks that have been added. More...
 
virtual void Disable (void)
 Disables the ChunkStay, the chunks are released and the ChunkStay object can be edited with Add() and Remove() again. More...
 
void Enable (cChunkMap &a_ChunkMap)
 Enables the ChunkStay on the specified chunkmap, causing it to load and generate chunks. More...
 
const cChunkCoordsVectorGetChunks (void) const
 Returns all the chunks that should be kept. More...
 
void Remove (int a_ChunkX, int a_ChunkZ)
 Releases the chunk so that it's no longer locked from unloading. More...
 
virtual ~cChunkStay ()
 Deletes the object. More...
 

Private Member Functions

void BuildNetherPortal (Vector3i a_Location, Direction a_Direction, bool a_IncludePlatform)
 Builds a portal. More...
 
bool IsValidBuildLocation (Vector3i a_BlockPosition)
 Whether the given location is a valid location to build a portal. More...
 

Private Attributes

bool m_BuildPlatform
 Whether to build a platform. More...
 
Direction m_Dir
 The direction of the portal. More...
 
UInt32 m_EntityID
 The ID of the entity that's being moved. More...
 
bool m_FoundPortal
 Whether we found a portal during the loading of the chunks. More...
 
int m_MaxY
 The maximum Y to scan to. More...
 
Vector3i m_PortalLoc
 The position of the pre-existing portal. More...
 
Vector3d m_Position
 The center of the search area. More...
 
cWorldm_SourceWorld
 The world we're moving the entity from, used to query the entity ID. More...
 
cWorldm_World
 The world we're moving the entity to. More...
 

Static Private Attributes

static const double AcrossOffset = 0.5
 
static const int BuildSearchRadius = 16
 
static const double OutOffset = 0.5
 Where to place the player out from the face and across the face. More...
 
static const int PortalHeight = 5
 
static const int PortalLength = 4
 Length and height, including the obsidian. More...
 
static const int SearchRadius = 128
 
static const int SearchSolidBaseWidth = 3
 The width of a solid base to search for when building. More...
 

Additional Inherited Members

- Protected Member Functions inherited from cChunkStay
bool ChunkAvailable (int a_ChunkX, int a_ChunkZ)
 Called by cChunkMap when a chunk is available, checks m_NumLoaded and triggers the appropriate callbacks. More...
 
- Protected Attributes inherited from cChunkStay
cChunkMapm_ChunkMap
 The chunkmap where the object is enabled. More...
 
cChunkCoordsVector m_Chunks
 The list of chunks to lock from unloading. More...
 
cChunkCoordsVector m_OutstandingChunks
 The chunks that still need loading. More...
 

Detailed Description

Definition at line 15 of file NetherPortalScanner.h.

Member Enumeration Documentation

◆ Direction

Enumerator

Definition at line 23 of file NetherPortalScanner.h.

Constructor & Destructor Documentation

◆ cNetherPortalScanner()

cNetherPortalScanner::cNetherPortalScanner ( cEntity a_MovingEntity,
cWorld a_DestinationWorld,
Vector3d  a_DestPosition,
int  a_MaxY 
)

Definition at line 20 of file NetherPortalScanner.cpp.

Member Function Documentation

◆ BuildNetherPortal()

void cNetherPortalScanner::BuildNetherPortal ( Vector3i  a_Location,
Direction  a_Direction,
bool  a_IncludePlatform 
)
private

Builds a portal.

Definition at line 232 of file NetherPortalScanner.cpp.

◆ IsValidBuildLocation()

bool cNetherPortalScanner::IsValidBuildLocation ( Vector3i  a_BlockPosition)
private

Whether the given location is a valid location to build a portal.

Definition at line 124 of file NetherPortalScanner.cpp.

◆ OnAllChunksAvailable()

bool cNetherPortalScanner::OnAllChunksAvailable ( void  )
overridevirtual

Called once all of the contained chunks are available.

If returns true, the ChunkStay is automatically disabled by the ChunkMap; if it returns false, the ChunkStay is kept.

Implements cChunkStay.

Definition at line 155 of file NetherPortalScanner.cpp.

◆ OnChunkAvailable()

void cNetherPortalScanner::OnChunkAvailable ( int  a_ChunkX,
int  a_ChunkZ 
)
overridevirtual

Called when a specific chunk become available.

Implements cChunkStay.

Definition at line 49 of file NetherPortalScanner.cpp.

◆ OnDisabled()

void cNetherPortalScanner::OnDisabled ( void  )
overridevirtual

Called by the ChunkMap when the ChunkStay is disabled.

The object may choose to delete itself.

Implements cChunkStay.

Definition at line 310 of file NetherPortalScanner.cpp.

Member Data Documentation

◆ AcrossOffset

const double cNetherPortalScanner::AcrossOffset = 0.5
staticprivate

Definition at line 43 of file NetherPortalScanner.h.

◆ BuildSearchRadius

const int cNetherPortalScanner::BuildSearchRadius = 16
staticprivate

Definition at line 36 of file NetherPortalScanner.h.

◆ m_BuildPlatform

bool cNetherPortalScanner::m_BuildPlatform
private

Whether to build a platform.

True if we couldn't build the portal on solid ground

Definition at line 64 of file NetherPortalScanner.h.

◆ m_Dir

Direction cNetherPortalScanner::m_Dir
private

The direction of the portal.

Definition at line 67 of file NetherPortalScanner.h.

◆ m_EntityID

UInt32 cNetherPortalScanner::m_EntityID
private

The ID of the entity that's being moved.

Definition at line 52 of file NetherPortalScanner.h.

◆ m_FoundPortal

bool cNetherPortalScanner::m_FoundPortal
private

Whether we found a portal during the loading of the chunks.

Definition at line 61 of file NetherPortalScanner.h.

◆ m_MaxY

int cNetherPortalScanner::m_MaxY
private

The maximum Y to scan to.

Definition at line 76 of file NetherPortalScanner.h.

◆ m_PortalLoc

Vector3i cNetherPortalScanner::m_PortalLoc
private

The position of the pre-existing portal.

Definition at line 70 of file NetherPortalScanner.h.

◆ m_Position

Vector3d cNetherPortalScanner::m_Position
private

The center of the search area.

Definition at line 73 of file NetherPortalScanner.h.

◆ m_SourceWorld

cWorld& cNetherPortalScanner::m_SourceWorld
private

The world we're moving the entity from, used to query the entity ID.

Definition at line 55 of file NetherPortalScanner.h.

◆ m_World

cWorld& cNetherPortalScanner::m_World
private

The world we're moving the entity to.

Definition at line 58 of file NetherPortalScanner.h.

◆ OutOffset

const double cNetherPortalScanner::OutOffset = 0.5
staticprivate

Where to place the player out from the face and across the face.

Definition at line 42 of file NetherPortalScanner.h.

◆ PortalHeight

const int cNetherPortalScanner::PortalHeight = 5
staticprivate

Definition at line 33 of file NetherPortalScanner.h.

◆ PortalLength

const int cNetherPortalScanner::PortalLength = 4
staticprivate

Length and height, including the obsidian.

Definition at line 32 of file NetherPortalScanner.h.

◆ SearchRadius

const int cNetherPortalScanner::SearchRadius = 128
staticprivate

Definition at line 35 of file NetherPortalScanner.h.

◆ SearchSolidBaseWidth

const int cNetherPortalScanner::SearchSolidBaseWidth = 3
staticprivate

The width of a solid base to search for when building.

Definition at line 39 of file NetherPortalScanner.h.


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