4 #include "../BlockEntities/ChestEntity.h" 5 #include "../BlockArea.h" 6 #include "../Entities/Player.h" 14 public cMetaRotator<cContainerEntityHandler<cBlockEntityHandler>, 0x07, 0x02, 0x05, 0x03, 0x04>
31 int a_BlockX,
int a_BlockY,
int a_BlockZ,
eBlockFace a_BlockFace,
32 int a_CursorX,
int a_CursorY,
int a_CursorZ,
39 if (!
CanBeAt(a_ChunkInterface, a_BlockX, a_BlockY, a_BlockZ))
47 if (!Area.
Read(a_ChunkInterface, a_BlockX - 1, a_BlockX + 1, a_BlockY, a_BlockY, a_BlockZ - 1, a_BlockZ + 1))
51 double yaw = a_Player.
GetYaw();
57 a_BlockMeta = ((yaw >= -90) && (yaw < 90)) ? 2 : 3;
66 a_BlockMeta = (yaw < 0) ? 4 : 5;
83 return CanBeAt(a_ChunkInterface, BlockX, a_RelY, BlockZ);
93 if (!Area.
Read(a_ChunkInterface, a_BlockX - 2, a_BlockX + 2, a_BlockY, a_BlockY, a_BlockZ - 2, a_BlockZ + 2))
99 int NumChestNeighbors = 0;
111 NumChestNeighbors += 1;
124 NumChestNeighbors += 1;
137 NumChestNeighbors += 1;
150 NumChestNeighbors += 1;
152 return (NumChestNeighbors < 2);
168 if ((a_Yaw >= 0.f) && (a_Yaw < 90.f))
172 else if ((a_Yaw >= 180) && (a_Yaw < 270))
176 else if ((a_Yaw >= 90) && (a_Yaw < 180))
static NIBBLETYPE PlayerYawToMetaData(double a_Yaw)
Translates player yaw when placing a chest into the chest block metadata.
int GetOriginZ(void) const
unsigned char BLOCKTYPE
The datatype used by blockdata.
cBlockChestHandler(BLOCKTYPE a_BlockType)
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.
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
bool CheckAndAdjustNeighbor(cChunkInterface &a_ChunkInterface, const cBlockArea &a_Area, int a_RelX, int a_RelZ, NIBBLETYPE a_NewMeta)
If there's a chest in the a_Area in the specified coords, modifies its meta to a_NewMeta and returns ...
int GetOriginY(void) const
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...
Mixin for rotations and reflections following the standard pattern of "apply mask, then use a switch".
BLOCKTYPE GetRelBlockType(int a_RelX, int a_RelY, int a_RelZ) const
virtual bool CanBeAt(cChunkInterface &a_ChunkInterface, int a_BlockX, int a_BlockY, int a_BlockZ)
double GetYaw(void) const
eBlockFace
Block face constants, used in PlayerDigging and PlayerBlockPlacement packets and bbox collision calc...
bool Read(cForEachChunkProvider &a_ForEachChunkProvider, int a_MinBlockX, int a_MaxBlockX, int a_MinBlockY, int a_MaxBlockY, int a_MinBlockZ, int a_MaxBlockZ, int a_DataTypes=baTypes|baMetas|baBlockEntities)
Reads an area of blocks specified.
int GetOriginX(void) const
void SetBlockMeta(Vector3i a_BlockPos, NIBBLETYPE a_MetaData, bool a_ShouldMarkDirty=true, bool a_ShouldInformClient=true)
Sets the meta for the specified block, while keeping the blocktype.
virtual bool CanBeAt(cChunkInterface &a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk &a_Chunk) override
Checks if the block can stay at the specified relative coords in the chunk.