12 E_META_END_PORTAL_FRAME_ZM,
13 E_META_END_PORTAL_FRAME_XP,
14 E_META_END_PORTAL_FRAME_ZP,
15 E_META_END_PORTAL_FRAME_XM
35 int a_BlockX,
int a_BlockY,
int a_BlockZ,
eBlockFace a_BlockFace,
36 int a_CursorX,
int a_CursorY,
int a_CursorZ,
51 a_Rotation += 90 + 45;
57 if ((a_Rotation >= 0) && (a_Rotation < 90))
61 else if ((a_Rotation >= 180) && (a_Rotation < 270))
65 else if ((a_Rotation >= 90) && (a_Rotation < 180))
87 FindAndSetPortal(a_BlockPos, a_BlockMeta & 3, a_ChunkInterface, a_WorldInterface);
112 const int MIN_PORTAL_WIDTH = 3;
113 const int MAX_PORTAL_WIDTH = 4;
123 static const Vector3i LeftForward[] =
132 int EdgesComplete = -1;
134 int EdgeWidth[4] = { 1, 1, 1, 1 };
139 while (EdgesComplete < 4)
142 Vector3i NextPos = CurrentPos + LeftForward[CurrentDirection];
150 NorthWestCorner = NextPos - Left[CurrentDirection];
153 if (EdgesComplete == -1)
156 EdgeWidth[CurrentDirection] = 1;
160 CurrentDirection = (CurrentDirection + 1) % 4;
166 NextPos = CurrentPos + Left[CurrentDirection];
168 EdgeWidth[CurrentDirection]++;
169 if (EdgeWidth[CurrentDirection] > MAX_PORTAL_WIDTH)
182 CurrentPos = NextPos;
185 if ((EdgeWidth[0] != EdgeWidth[2]) || (EdgeWidth[1] != EdgeWidth[3]))
190 if ((EdgeWidth[0] < MIN_PORTAL_WIDTH) || (EdgeWidth[1] < MIN_PORTAL_WIDTH))
198 for (
int i = 0; i < EdgeWidth[0]; i++)
200 for (
int j = 0; j < EdgeWidth[1]; j++)
void SetBlock(Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
Sets the block at the specified coords to the specified value.
unsigned char BLOCKTYPE
The datatype used by blockdata.
virtual bool IsClickedThrough(void) override
Indicates whether the client will click through this block.
bool GetBlockTypeMeta(Vector3i a_Pos, BLOCKTYPE &a_BlockType, NIBBLETYPE &a_BlockMeta)
bool IsPortalFrame(BLOCKTYPE BlockType)
Return true if this block is a portal frame.
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
cBlockEndPortalFrameHandler(BLOCKTYPE a_BlockType)
Mixin for rotations and reflections following the standard pattern of "apply mask, then use a switch".
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
Returns the base colour ID of the block, as will be represented on a map, as per documentation: https...
bool FindAndSetPortal(Vector3i a_FirstFrame, NIBBLETYPE a_Direction, cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface)
Returns false if portal cannot be made, true if portal was made.
virtual bool GetPlacementBlockTypeMeta(cChunkInterface &a_ChunkInterface, cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE &a_BlockType, NIBBLETYPE &a_BlockMeta) override
Called before a block is placed into a world.
virtual void OnPlaced(cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override
Called by cWorld::SetBlock() after the block has been set.
double GetYaw(void) const
eBlockFace
Block face constants, used in PlayerDigging and PlayerBlockPlacement packets and bbox collision calc...
BLOCKTYPE GetBlock(Vector3i a_Pos)
bool IsValidFrameAtPos(cChunkInterface &a_ChunkInterface, Vector3i a_BlockPos, NIBBLETYPE a_ShouldFace)
Return true if this block is a portal frame, has an eye, and is facing the correct direction...
static NIBBLETYPE YawToMetaData(double a_Rotation)