8 #include "../Entities/Player.h" 10 #include "../BoundingBox.h" 11 #include "../Mobs/Monster.h" 12 #include "../BlockEntities/BedEntity.h" 21 if ((a_OldBlockMeta & 0x08) != 0)
55 Vector3i Coords(a_BlockX, a_BlockY, a_BlockZ);
67 if ((Meta & 0x4) == 0x4)
73 auto FindMobs = [](
cEntity & a_Entity)
89 if ((Meta & 0x8) == 0x8)
97 VERIFY((Meta & 0x4) != 0x4);
111 auto TimeFastForwardTester = [](
cPlayer & a_OtherPlayer)
113 if (!a_OtherPlayer.IsInBed())
130 a_ChunkInterface.
SetBlockMeta({a_BlockX, a_BlockY, a_BlockZ}, Meta & 0x0b);
159 if (a_BlockEntity !=
nullptr)
161 color =
reinterpret_cast<cBedEntity *
>(a_BlockEntity)->GetColor();
void SetBlock(Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
Sets the block at the specified coords to the specified value.
virtual bool ForEachEntityInBox(const cBoundingBox &a_Box, cEntityCallback a_Callback) override
Calls the callback for each entity that has a nonempty intersection with the specified boundingbox...
virtual void OnPlacedByPlayer(cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, cPlayer &a_Player, const sSetBlock &a_BlockChange) override
Called by cPlayer::PlaceBlocks() for each block after it has been set to the world.
void FastSetBlock(Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
Sets the block at the specified coords to the specified value.
virtual bool ForEachPlayer(cPlayerListCallback a_Callback)=0
Calls the callback for each player in the list; returns true if all players processed, false if the callback aborted by returning true.
virtual void SetTimeOfDay(int a_TimeOfDay)=0
unsigned char BLOCKTYPE
The datatype used by blockdata.
virtual void OnBroken(cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, Vector3i a_BlockPos, BLOCKTYPE a_OldBlockType, NIBBLETYPE a_OldBlockMeta) override
Called after a block gets broken (replaced with air), either by player or by natural means...
int GetY(void) const
Returns the absolute Y coord of the stored block.
const cItem & GetEquippedItem(void) const
static Vector3i MetaDataToDirection(NIBBLETYPE a_MetaData)
virtual bool DoWithBedAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBedCallback a_Callback) override
Calls the callback for the bed at the specified coords; returns false if there's no bed at those coor...
static void SetBedOccupationState(cChunkInterface &a_ChunkInterface, Vector3i a_BedPosition, bool a_IsOccupied)
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
void SetBedPos(const Vector3i &a_Pos)
Sets the player's bed (home / respawn) position to the specified position.
Represents two sets of coords, minimum and maximum for each direction.
virtual void DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_BlockY, double a_BlockZ, bool a_CanCauseFire, eExplosionSource a_Source, void *a_SourceData)=0
int GetZ(void) const
Returns the absolute Z coord of the stored block.
void SetIsInBed(bool a_Flag)
Sets a player's in-bed state We can't be sure plugins will keep this value updated, so no exporting If value is false (not in bed), will update players of the fact that they have been ejected from the bed.
virtual bool OnUse(cChunkInterface &a_ChunkInterface, cWorldInterface &a_WorldInterface, cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
Called if the user right clicks the block and the block is useable returns true if the use was succes...
int GetX(void) const
Returns the absolute X coord of the stored block.
void SendMessageFailure(const AString &a_Message)
Vector3i GetLastBedPos(void) const
Gets the last position that the player slept in This is initialised to the world spawn point if the p...
void SendMessageSuccess(const AString &a_Message)
eBlockFace
Block face constants, used in PlayerDigging and PlayerBlockPlacement packets and bbox collision calc...
NIBBLETYPE GetBlockMeta(Vector3i a_Pos)
BLOCKTYPE GetBlock(Vector3i a_Pos)
virtual int GetTimeOfDay(void) const =0
virtual void BroadcastUseBed(const cEntity &a_Entity, Vector3i a_BedPos)=0
const Vector3d & GetPosition(void) const
Exported in ManualBindings.
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 eDimension GetDimension(void) const =0
virtual cBroadcastInterface & GetBroadcastManager()=0
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, cBlockEntity *a_BlockEntity, const cEntity *a_Digger, const cItem *a_Tool) override
Returns the pickups that would result if the block was mined by a_Digger using a_Tool.
cWorld * GetWorld(void) const
This class bridges a vector of cItem for safe access via Lua.