2015-05-26 21:35:28 -04:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ChunkStay.h"
|
|
|
|
|
|
|
|
|
|
|
|
class cEntity;
|
|
|
|
class cWorld;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// This is the chunk stay which finds nearby nether portals
|
|
|
|
class cNetherPortalScanner : public cChunkStay
|
|
|
|
{
|
|
|
|
public:
|
2020-04-10 16:08:19 -04:00
|
|
|
cNetherPortalScanner(cEntity & a_MovingEntity, cWorld & a_DestinationWorld, Vector3d a_DestPosition, int a_MaxY);
|
2015-05-26 21:35:28 -04:00
|
|
|
virtual void OnChunkAvailable(int a_ChunkX, int a_ChunkY) override;
|
|
|
|
virtual bool OnAllChunksAvailable(void) override;
|
|
|
|
virtual void OnDisabled(void) override;
|
|
|
|
|
|
|
|
enum class Direction
|
|
|
|
{
|
|
|
|
X,
|
|
|
|
Y
|
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
/** Length and height, including the obsidian. */
|
|
|
|
static const int PortalLength = 4;
|
|
|
|
static const int PortalHeight = 5;
|
|
|
|
|
|
|
|
static const int SearchRadius = 128;
|
|
|
|
static const int BuildSearchRadius = 16;
|
|
|
|
|
|
|
|
/** The width of a solid base to search for when building. */
|
|
|
|
static const int SearchSolidBaseWidth = 3;
|
|
|
|
|
|
|
|
/** Where to place the player out from the face and across the face */
|
2018-05-06 13:07:34 -04:00
|
|
|
static const double OutOffset;
|
|
|
|
static const double AcrossOffset;
|
2015-05-26 21:35:28 -04:00
|
|
|
|
|
|
|
/** Builds a portal. */
|
|
|
|
void BuildNetherPortal(Vector3i a_Location, Direction a_Direction, bool a_IncludePlatform);
|
|
|
|
|
|
|
|
/** Whether the given location is a valid location to build a portal. */
|
|
|
|
bool IsValidBuildLocation(Vector3i a_BlockPosition);
|
|
|
|
|
2020-04-05 08:41:14 -04:00
|
|
|
/** The ID of the entity that's being moved. */
|
|
|
|
UInt32 m_EntityID;
|
|
|
|
|
|
|
|
/** The world we're moving the entity from, used to query the entity ID. */
|
|
|
|
cWorld & m_SourceWorld;
|
2015-05-26 21:35:28 -04:00
|
|
|
|
|
|
|
/** The world we're moving the entity to. */
|
2020-04-10 16:08:19 -04:00
|
|
|
cWorld & m_World;
|
2015-05-26 21:35:28 -04:00
|
|
|
|
|
|
|
/** Whether we found a portal during the loading of the chunks. */
|
|
|
|
bool m_FoundPortal;
|
|
|
|
|
|
|
|
/** Whether to build a platform. True if we couldn't build the portal on solid ground */
|
|
|
|
bool m_BuildPlatform;
|
|
|
|
|
|
|
|
/** The direction of the portal. */
|
|
|
|
Direction m_Dir;
|
|
|
|
|
|
|
|
/** The position of the pre-existing portal. */
|
|
|
|
Vector3i m_PortalLoc;
|
|
|
|
|
|
|
|
/** The center of the search area */
|
|
|
|
Vector3d m_Position;
|
|
|
|
|
|
|
|
/** The maximum Y to scan to */
|
|
|
|
int m_MaxY;
|
|
|
|
};
|