5 #include "../BlockInfo.h"
6 #include "../Entities/Player.h"
17 public cYawRotator<cBlockHandler, 0x03, 0x03, 0x00, 0x01, 0x02>
51 switch (a_BlockMeta & 0x03)
87 return (Meta & 0x04) != 0;
100 bool IsOpened = ((Meta & 0x04) != 0);
101 if (IsOpened == a_Open)
108 if ((Meta & 0x08) == 0)
116 if (a_BlockPos.
y > 0)
172 ASSERT(!
"Unhandled door type!");
198 const auto BasePosition = a_Position.
addedY(((a_Meta & 0x8) == 0x8) ? -2 : -1);
216 if ((Meta & 0x08) != 0)
219 if (a_BlockPos.
y > 0)
222 return static_cast<NIBBLETYPE>((DownMeta & 0x07) | 0x08 | (Meta << 4));
225 return static_cast<NIBBLETYPE>(0x08 | (Meta << 4));
233 return static_cast<NIBBLETYPE>(Meta | (UpMeta << 4));
247 SetOpen(a_ChunkInterface, a_BlockPos, !
IsOpen(a_ChunkInterface, a_BlockPos));
268 ASSERT(!
"Unhandled blocktype in door handler!");
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.
static bool IsTransparent(BLOCKTYPE Block)
Is a block transparent? (https://minecraft.wiki/w/Opacity)
static void SetOpen(cChunkInterface &a_ChunkInterface, const Vector3i a_BlockPos, bool a_Open)
Sets the door to the specified state.
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override
static NIBBLETYPE GetCompleteDoorMeta(cChunkInterface &a_ChunkInterface, const Vector3i a_BlockPos)
Returns the complete meta composed from the both parts of the door as (TopMeta << 4) | BottomMeta The...
virtual NIBBLETYPE MetaMirrorYZ(NIBBLETYPE a_Meta) const override
virtual cBoundingBox GetPlacementCollisionBox(BLOCKTYPE a_XM, BLOCKTYPE a_XP, BLOCKTYPE a_YM, BLOCKTYPE a_YP, BLOCKTYPE a_ZM, BLOCKTYPE a_ZP) const override
static void ChangeDoor(cChunkInterface &a_ChunkInterface, const Vector3i a_BlockPos)
Changes the door at the specified coords from open to close or vice versa.
static bool IsOpen(cChunkInterface &a_ChunkInterface, const Vector3i a_BlockPos)
Returns true iff the door at the specified coords is open.
virtual bool OnUse(cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, cPlayer &a_Player, const Vector3i a_BlockPos, eBlockFace a_BlockFace, const Vector3i a_CursorPos) const override
virtual void OnCancelRightClick(cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, cPlayer &a_Player, const Vector3i a_BlockPos, eBlockFace a_BlockFace) const override
virtual NIBBLETYPE MetaRotateCW(NIBBLETYPE a_Meta) const override
virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem *const a_Tool) const override
static Vector3i GetRelativeDirectionToOutside(NIBBLETYPE a_BlockMeta)
Returns a vector pointing one block in the direction the door is facing (where the outside is).
static bool IsDoorBlockType(BLOCKTYPE a_Block)
Returns true if the specified blocktype is any kind of door.
virtual NIBBLETYPE MetaMirrorXY(NIBBLETYPE a_Meta) const override
virtual bool IsUseable(void) const override
virtual NIBBLETYPE MetaRotateCCW(NIBBLETYPE a_Meta) const override
virtual bool CanBeAt(const cChunk &a_Chunk, const Vector3i a_Position, const NIBBLETYPE a_Meta) const override
static bool CanBeOn(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
Returns true if door can be placed on the specified block type.
virtual void OnBroken(cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, Vector3i a_BlockPos, BLOCKTYPE a_OldBlockType, NIBBLETYPE a_OldBlockMeta, const cEntity *a_Digger) const override
static bool IsAnySlabType(BLOCKTYPE a_BlockType)
Returns true if the specified blocktype is one of the slabs handled by this handler.
void SetBlockMeta(Vector3i a_BlockPos, NIBBLETYPE a_MetaData)
Sets the meta for the specified block, while keeping the blocktype.
NIBBLETYPE GetBlockMeta(Vector3i a_Pos)
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
Represents two sets of coords, minimum and maximum for each direction.
void GetBlockTypeMeta(Vector3i a_RelPos, BLOCKTYPE &a_BlockType, NIBBLETYPE &a_BlockMeta) const
This class bridges a vector of cItem for safe access via Lua.
Vector3< T > addedY(T a_AddY) const
Returns a copy of this vector moved by the specified amount on the y axis.