12 E_META_END_PORTAL_FRAME_ZP,
13 E_META_END_PORTAL_FRAME_XM,
14 E_META_END_PORTAL_FRAME_ZM,
15 E_META_END_PORTAL_FRAME_XP
40 FindAndSetPortal(a_BlockPos, a_BlockMeta & 3, a_ChunkInterface, a_WorldInterface);
65 const int MIN_PORTAL_WIDTH = 3;
66 const int MAX_PORTAL_WIDTH = 4;
76 static const Vector3i LeftForward[] =
85 int EdgesComplete = -1;
87 int EdgeWidth[4] = { 1, 1, 1, 1 };
92 while (EdgesComplete < 4)
95 Vector3i NextPos = CurrentPos + LeftForward[CurrentDirection];
103 NorthWestCorner = NextPos - Left[CurrentDirection];
106 if (EdgesComplete == -1)
109 EdgeWidth[CurrentDirection] = 1;
113 CurrentDirection = (CurrentDirection + 1) % 4;
119 NextPos = CurrentPos + Left[CurrentDirection];
121 EdgeWidth[CurrentDirection]++;
122 if (EdgeWidth[CurrentDirection] > MAX_PORTAL_WIDTH)
135 CurrentPos = NextPos;
138 if ((EdgeWidth[0] != EdgeWidth[2]) || (EdgeWidth[1] != EdgeWidth[3]))
143 if ((EdgeWidth[0] < MIN_PORTAL_WIDTH) || (EdgeWidth[1] < MIN_PORTAL_WIDTH))
151 for (
int i = 0; i < EdgeWidth[0]; i++)
153 for (
int j = 0; j < EdgeWidth[1]; j++)
@ E_META_END_PORTAL_FRAME_EYE
@ E_META_END_PORTAL_FRAME_XP
@ E_META_END_PORTAL_FRAME_ZP
@ E_META_END_PORTAL_FRAME_XM
@ E_META_END_PORTAL_FRAME_ZM
@ E_BLOCK_END_PORTAL_FRAME
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
unsigned char BLOCKTYPE
The datatype used by blockdata.
static 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.
static 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 bool IsPortalFrame(BLOCKTYPE BlockType)
Return true if this block is a portal frame.
virtual void OnPlaced(cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) const override
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override
bool GetBlockTypeMeta(Vector3i a_Pos, BLOCKTYPE &a_BlockType, NIBBLETYPE &a_BlockMeta)
void SetBlock(Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
Sets the block at the specified coords to the specified value.
BLOCKTYPE GetBlock(Vector3i a_Pos)
Mixin for blocks whose meta on placement depends on the yaw of the player placing the block.
cMetaRotator< cBlockHandler, BitMask, North, East, South, West, false > Super