5 #include "../BlockInfo.h"
7 #include "../Simulator/FluidSimulator.h"
8 #include "../Blocks/BlockHandler.h"
9 #include "../LineBlockTracer.h"
10 #include "../Blocks/ChunkInterface.h"
37 const cItem & a_HeldItem,
49 ASSERT(!
"Unhandled ItemType");
103 if ((BlockPos.
x - a_Player->
GetPosX() > 5) || (BlockPos.
z - a_Player->
GetPosZ() > 5))
154 if ((BlockPos.
x - a_Player->
GetPosX() > 5) || (BlockPos.
z - a_Player->
GetPosZ() > 5))
178 return a_Player->
PlaceBlock(BlockPos, a_FluidBlock, 0);
188 public cBlockTracer::cCallbacks
204 if (a_BlockMeta != 0)
208 m_HasHitFluid =
true;
209 m_Pos = a_BlockPosition;
220 Tracer.
Trace(Start, End);
222 if (!Callbacks.m_HasHitFluid)
228 a_BlockPos = Callbacks.m_Pos;
239 public cBlockTracer::cCallbacks
251 m_ReplacedBlockType = a_CBBlockType;
252 m_ReplacedBlockMeta = a_CBBlockMeta;
253 m_EntryFace =
static_cast<eBlockFace>(a_CBEntryFace);
258 m_Pos = a_CBBlockPos;
272 if (!Tracer.
Trace(Start, End))
274 a_BlockPos = Callbacks.m_Pos;
275 a_BlockType = Callbacks.m_ReplacedBlockType;
276 a_BlockMeta = Callbacks.m_ReplacedBlockMeta;
277 a_BlockFace = Callbacks.m_EntryFace;
bool IsBlockWater(BLOCKTYPE a_BlockType)
bool IsBlockLiquid(BLOCKTYPE a_BlockType)
bool IsBlockLava(BLOCKTYPE a_BlockType)
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.
virtual bool CallHookPlayerBreakingBlock(cPlayer &a_Player, Vector3i a_BlockPos, eBlockFace a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)=0
virtual bool CallHookPlayerBrokenBlock(cPlayer &a_Player, Vector3i a_BlockPos, eBlockFace a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)=0
double GetPosX(void) const
double GetPosZ(void) const
Vector3d GetLookVector(void) const
bool IsGameModeCreative(void) const
Returns true if the player is in Creative mode, either explicitly, or by inheriting from current worl...
Vector3d GetEyePosition(void) const
void ReplaceOneEquippedItemTossRest(const cItem &)
Removes one item from the the current equipped item stack, and attempts to add the specified item sta...
bool IsGameModeAdventure(void) const
Returns true if the player is in Adventure mode, either explicitly, or by inheriting from current wor...
bool PlaceBlock(Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
Attempts to place the block in the world with a call to PlaceBlocks.
constexpr cItemBucketHandler(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).
bool ScoopUpFluid(cWorld *a_World, cPlayer *a_Player, const cItem &a_Item, const Vector3i a_ClickedBlockPos, eBlockFace a_ClickedBlockFace) const
bool GetBlockFromTrace(cWorld *a_World, cPlayer *a_Player, Vector3i &a_BlockPos) const
bool GetPlacementCoordsFromTrace(cWorld *a_World, cPlayer *a_Player, Vector3i &a_BlockPos, BLOCKTYPE &a_BlockType, NIBBLETYPE &a_BlockMeta, eBlockFace &a_BlockFace) const
bool PlaceFluid(cWorld *a_World, cPlayer *a_Player, cBlockPluginInterface &a_PluginInterface, const cItem &a_Item, const Vector3i a_BlockPos, eBlockFace a_BlockFace, BLOCKTYPE a_FluidBlock) const
constexpr cItemHandler(int a_ItemType)
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...
static bool CanWashAway(BLOCKTYPE a_BlockType)
bool DropBlockAsPickups(Vector3i a_BlockPos, const cEntity *a_Digger=nullptr, const cItem *a_Tool=nullptr)
Digs the specified block, and spawns the appropriate pickups for it.
BLOCKTYPE GetBlock(Vector3i a_BlockPos) const
Returns the block type at the specified position.
NIBBLETYPE GetBlockMeta(Vector3i a_BlockPos) const
Returns the block meta at the specified position.