Cuberite
A lightweight, fast and extensible game server for Minecraft
|
#include <NetherPortalScanner.h>
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 cChunkCoordsVector & | GetChunks (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... | |
cWorld & | m_SourceWorld |
The world we're moving the entity from, used to query the entity ID. More... | |
cWorld & | m_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 | |
cChunkMap * | m_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... | |
Definition at line 15 of file NetherPortalScanner.h.
|
strong |
Enumerator | |
---|---|
X | |
Y |
Definition at line 23 of file NetherPortalScanner.h.
cNetherPortalScanner::cNetherPortalScanner | ( | cEntity & | a_MovingEntity, |
cWorld & | a_DestinationWorld, | ||
Vector3d | a_DestPosition, | ||
int | a_MaxY | ||
) |
Definition at line 20 of file NetherPortalScanner.cpp.
|
private |
Builds a portal.
Definition at line 232 of file NetherPortalScanner.cpp.
|
private |
Whether the given location is a valid location to build a portal.
Definition at line 124 of file NetherPortalScanner.cpp.
|
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.
|
overridevirtual |
Called when a specific chunk become available.
Implements cChunkStay.
Definition at line 49 of file NetherPortalScanner.cpp.
|
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.
|
staticprivate |
Definition at line 43 of file NetherPortalScanner.h.
|
staticprivate |
Definition at line 36 of file NetherPortalScanner.h.
|
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.
|
private |
The direction of the portal.
Definition at line 67 of file NetherPortalScanner.h.
|
private |
The ID of the entity that's being moved.
Definition at line 52 of file NetherPortalScanner.h.
|
private |
Whether we found a portal during the loading of the chunks.
Definition at line 61 of file NetherPortalScanner.h.
|
private |
The maximum Y to scan to.
Definition at line 76 of file NetherPortalScanner.h.
|
private |
The position of the pre-existing portal.
Definition at line 70 of file NetherPortalScanner.h.
|
private |
The center of the search area.
Definition at line 73 of file NetherPortalScanner.h.
|
private |
The world we're moving the entity from, used to query the entity ID.
Definition at line 55 of file NetherPortalScanner.h.
|
private |
The world we're moving the entity to.
Definition at line 58 of file NetherPortalScanner.h.
|
staticprivate |
Where to place the player out from the face and across the face.
Definition at line 42 of file NetherPortalScanner.h.
|
staticprivate |
Definition at line 33 of file NetherPortalScanner.h.
|
staticprivate |
Length and height, including the obsidian.
Definition at line 32 of file NetherPortalScanner.h.
|
staticprivate |
Definition at line 35 of file NetherPortalScanner.h.
|
staticprivate |
The width of a solid base to search for when building.
Definition at line 39 of file NetherPortalScanner.h.