27 static const Vector3i CrossCoords[] =
38 for (
size_t i = 0; i <
ARRAYCOUNT(CrossCoords); i++)
40 const auto NeighborPos = a_PlacePosition + CrossCoords[i];
50 NeighborIdx =
static_cast<int>(i);
53 for (
size_t j = 0; j <
ARRAYCOUNT(CrossCoords); j++)
66 const auto yaw = a_Player.
GetYaw();
92 if (!a_Player.
PlaceBlock(a_PlacePosition, ChestBlockType, Meta))
98 if (NeighborIdx != -1)
100 World.FastSetBlock(a_PlacePosition + CrossCoords[NeighborIdx], ChestBlockType, Meta);
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.
#define ARRAYCOUNT(X)
Evaluates to the number of elements in an array (compile-time!)
Utilities to allow casting a cWorld to one of its interfaces without including World....
static NIBBLETYPE YawToMetaData(double a_Rotation)
Converts the rotation value as returned by cPlayer::GetYaw() to the appropriate metadata value for a ...
double GetYaw(void) const
cWorld * GetWorld(void) const
bool PlaceBlock(Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
Attempts to place the block in the world with a call to PlaceBlocks.
cItemChestHandler(const cItemChestHandler &)=delete
virtual bool CommitPlacement(cPlayer &a_Player, const cItem &a_HeldItem, const Vector3i a_PlacePosition, const eBlockFace a_ClickedBlockFace, const Vector3i a_CursorPosition) const override
Performs the actual placement of this placeable item.
constexpr cItemHandler(int a_ItemType)