53 FindAndSetPortal(a_ClickedBlockPos, FacingMeta & 3, ChunkInterface, *a_World);
86 const int MIN_PORTAL_WIDTH = 3;
87 const int MAX_PORTAL_WIDTH = 4;
97 static const Vector3i LeftForward[] =
106 int EdgesComplete = -1;
108 int EdgeWidth[4] = { 1, 1, 1, 1 };
113 while (EdgesComplete < 4)
116 Vector3i NextPos = CurrentPos + LeftForward[CurrentDirection];
124 NorthWestCorner = NextPos - Left[CurrentDirection];
127 if (EdgesComplete == -1)
130 EdgeWidth[CurrentDirection] = 1;
134 CurrentDirection = (CurrentDirection + 1) % 4;
140 NextPos = CurrentPos + Left[CurrentDirection];
142 EdgeWidth[CurrentDirection]++;
143 if (EdgeWidth[CurrentDirection] > MAX_PORTAL_WIDTH)
156 CurrentPos = NextPos;
159 if ((EdgeWidth[0] != EdgeWidth[2]) || (EdgeWidth[1] != EdgeWidth[3]))
164 if ((EdgeWidth[0] < MIN_PORTAL_WIDTH) || (EdgeWidth[1] < MIN_PORTAL_WIDTH))
170 for (
int i = 0; i < EdgeWidth[0]; i++)
172 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_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.
eBlockFace
Block face constants, used in PlayerDigging and PlayerBlockPlacement packets and bbox collision calc.
This interface is used to decouple block handlers from the cPluginManager dependency through cWorld.
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)
bool IsGameModeCreative(void) const
Returns true if the player is in Creative mode, either explicitly, or by inheriting from current worl...
cInventory & GetInventory(void)
bool RemoveOneEquippedItem(void)
Removes one item out of the currently equipped item stack, returns true if successful,...
static bool IsPortalFrame(BLOCKTYPE BlockType)
Return true if this block is a portal frame.
virtual bool OnItemUse(cWorld *a_World, cPlayer *a_Player, cBlockPluginInterface &a_PluginInterface, const cItem &a_Item, const Vector3i a_ClickedBlockPos, eBlockFace a_ClickedBlockFace) const override
Called when the player tries to use the item (right mouse button).
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 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.
constexpr cItemEyeOfEnderHandler(int a_ItemType)
constexpr cItemThrowableHandler(int a_ItemType, cProjectileEntity::eKind a_ProjectileKind, double a_SpeedCoeff)
bool GetBlockTypeMeta(Vector3i a_BlockPos, BLOCKTYPE &a_BlockType, NIBBLETYPE &a_BlockMeta) const
Retrieves the block type and meta at the specified coords.
cChunkMap * GetChunkMap(void)
void SetBlock(Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
Sets the block at the specified coords to the specified value.