5 #include "../Entities/Player.h"
6 #include "../LineBlockTracer.h"
42 const cItem & a_HeldItem,
53 const auto PlacePos =
AddFaceDirection(a_ClickedBlockPos, a_ClickedBlockFace);
57 const auto BlockToReplace = a_World->
GetBlock(PlacePos);
66 const auto Below = PlacePos.addedY(-1);
74 const auto BlockBelow = a_World->
GetBlock(Below);
92 public cBlockTracer::cCallbacks
120 const auto End = EyePosition + a_Player->
GetLookVector() * 5;
127 const auto BlockToReplace = a_World->
GetBlock(Callbacks.Position);
bool IsBlockWater(BLOCKTYPE a_BlockType)
@ E_BLOCK_STATIONARY_WATER
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
unsigned char BLOCKTYPE
The datatype used by blockdata.
void AddFaceDirection(int &a_BlockX, int &a_BlockY, int &a_BlockZ, eBlockFace a_BlockFace, bool a_bInverse)
Modifies the specified coords so that they point to the block adjacent to the one specified through i...
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.
Vector3d GetLookVector(void) const
cWorld * GetWorld(void) const
bool IsGameModeCreative(void) const
Returns true if the player is in Creative mode, either explicitly, or by inheriting from current worl...
cInventory & GetInventory(void)
Vector3d GetEyePosition(void) const
bool RemoveOneEquippedItem(void)
Removes one item out of the currently equipped item stack, returns true if successful,...
constexpr cItemHandler(int a_ItemType)
constexpr cItemLilypadHandler(int a_ItemType)
virtual bool OnItemUse(cWorld *a_World, cPlayer *a_Player, cBlockPluginInterface &a_PluginInterface, const cItem &a_HeldItem, const Vector3i a_ClickedBlockPos, eBlockFace a_ClickedBlockFace) const override
Called when the player tries to use the item (right mouse button).
virtual bool IsPlaceable(void) const override
Blocks simply get placed.
bool Trace(Vector3d a_Start, Vector3d a_End)
Traces one line between Start and End; returns true if the entire line was traced (until OnNoMoreHits...
BLOCKTYPE GetBlock(Vector3i a_BlockPos) const
Returns the block type at the specified position.
void SetBlock(Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
Sets the block at the specified coords to the specified value.