20 m_Entity(a_MovingEntity),
21 m_World(a_DestinationWorld),
23 m_BuildPlatform(true),
25 m_PortalLoc(a_DestPosition.Floor()),
26 m_Position(a_DestPosition),
33 for (
int x = MinX; x < MaxX; x++)
35 for (
int z = MinZ; z < MaxZ; z++)
150 std::vector<Vector3i> Possibilities;
161 Possibilities.push_back(
Vector3i(x, y, z));
167 if (Possibilities.size() > 0)
172 double DistanceToClosest = (Possibilities[0] -
m_Position).SqrLength();
173 Vector3i Closest = Possibilities[0];
174 for (
const auto & itr : Possibilities)
176 double Distance = (itr -
m_Position).SqrLength();
177 if (Distance < DistanceToClosest)
179 DistanceToClosest = Distance;
196 int x = a_Location.
x;
197 int y = a_Location.
y;
198 int z = a_Location.
z;
220 if (a_IncludePlatform)
298 FLOGD(
"Placing player at {0}", Position);
BLOCKTYPE GetBlock(Vector3i a_BlockPos)
Returns the block type at the specified position.
bool GetChunkBlockTypes(int a_ChunkX, int a_ChunkZ, BLOCKTYPE *a_BlockTypes)
Gets the chunk's blocks, only the block types.
BLOCKTYPE BlockTypes[NumBlocks]
The type used for block type operations and storage, AXIS_ORDER ordering.
static const int SearchSolidBaseWidth
The width of a solid base to search for when building.
static bool IsSolid(BLOCKTYPE a_Type)
unsigned char BLOCKTYPE
The datatype used by blockdata.
static const int NumBlocks
cNetherPortalScanner(cEntity *a_MovingEntity, cWorld *a_DestinationWorld, Vector3d a_DestPosition, int a_MaxY)
void ScheduleMoveToWorld(cWorld *a_World, Vector3d a_NewPosition, bool a_ShouldSetPortalCooldown=false, bool a_ShouldSendRespawn=false)
Schedules a MoveToWorld call to occur on the next Tick of the entity.
void Enable(cChunkMap &a_ChunkMap)
Enables the ChunkStay on the specified chunkmap, causing it to load and generate chunks.
Vector3i m_PortalLoc
The position of the pre-existing portal.
cWorld * m_World
The world we're moving the entity to.
bool m_BuildPlatform
Whether to build a platform.
cEntity * m_Entity
The entity that's being moved.
static const double OutOffset
Where to place the player out from the face and across the face.
virtual void OnDisabled(void) override
Called by the ChunkMap when the ChunkStay is disabled.
virtual void OnChunkAvailable(int a_ChunkX, int a_ChunkY) override
Called when a specific chunk become available.
Vector3< double > Vector3d
static const double AcrossOffset
int m_MaxY
The maximum Y to scan to.
static const int PortalHeight
static const int BuildSearchRadius
cChunkMap * GetChunkMap(void)
bool m_FoundPortal
Whether we found a portal during the loading of the chunks.
void BuildNetherPortal(Vector3i a_Location, Direction a_Direction, bool a_IncludePlatform)
Builds a portal.
void Add(int a_ChunkX, int a_ChunkZ)
Adds a chunk to be locked from unloading.
Direction m_Dir
The direction of the portal.
static const int SearchRadius
bool IsValidBuildLocation(Vector3i a_BlockPosition)
Whether the given location is a valid location to build a portal.
Vector3d m_Position
The center of the search area.
std::enable_if< std::is_arithmetic< T >::value, C >::type FloorC(T a_Value)
Floors a value, then casts it to C (an int by default)
static const int PortalLength
Length and height, including the obsidian.
void SetBlock(Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
Sets the block at the specified coords to the specified value.
virtual bool OnAllChunksAvailable(void) override
Caled once all of the contained chunks are available.
static Vector3i IndexToCoordinate(size_t index)
std::enable_if< std::is_arithmetic< T >::value, C >::type CeilC(T a_Value)
Ceils a value, then casts it to C (an int by default)