diff options
Diffstat (limited to '')
-rw-r--r-- | src/Blocks/WorldInterface.h | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/Blocks/WorldInterface.h b/src/Blocks/WorldInterface.h index 524e8d642..4c1f6ddc8 100644 --- a/src/Blocks/WorldInterface.h +++ b/src/Blocks/WorldInterface.h @@ -1,15 +1,18 @@ - + #pragma once - +#include <functional> #include "../Mobs/MonsterTypes.h" - -typedef cItemCallback<cBlockEntity> cBlockEntityCallback; +class cBedEntity; +class cBlockEntity; class cBroadcastInterface; class cItems; class cPlayer; +using cBedCallback = std::function<bool(cBedEntity &)>; +using cBlockEntityCallback = std::function<bool(cBlockEntity &)>; +using cPlayerListCallback = std::function<bool(cPlayer &)>; @@ -28,7 +31,10 @@ public: 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; - virtual bool DoWithBedAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBedCallback & a_Callback) = 0; + virtual bool DoWithBedAt(int a_BlockX, int a_BlockY, int a_BlockZ, const cBedCallback & a_Callback) = 0; + + /** Calls the callback for the block entity at the specified coords; returns false if there's no block entity at those coords, true if found */ + virtual bool DoWithBlockEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ, const cBlockEntityCallback & a_Callback) = 0; /** Spawns item pickups for each item in the list. May compress pickups if too many entities: */ virtual void SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double a_BlockY, double a_BlockZ, double a_FlyAwaySpeed = 1.0, bool IsPlayerCreated = false) = 0; @@ -46,19 +52,16 @@ public: Returns the UniqueID of the spawned experience orb, or cEntity::INVALID_ID on failure. */ virtual UInt32 SpawnExperienceOrb(double a_X, double a_Y, double a_Z, int a_Reward) = 0; - /** Calls the callback for the block entity at the specified coords; returns false if there's no block entity at those coords, true if found */ - virtual bool DoWithBlockEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBlockEntityCallback & a_Callback) = 0; - /** Sends the block on those coords to the player */ virtual void SendBlockTo(int a_BlockX, int a_BlockY, int a_BlockZ, cPlayer & a_Player) = 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 bool ForEachPlayer(cItemCallback<cPlayer> & a_Callback) = 0; + virtual bool ForEachPlayer(const cPlayerListCallback & a_Callback) = 0; /** Calls the callback for each entity that has a nonempty intersection with the specified boundingbox. Returns true if all entities processed, false if the callback aborted by returning true. If any chunk in the box is missing, ignores the entities in that chunk silently. */ - virtual bool ForEachEntityInBox(const cBoundingBox & a_Box, cEntityCallback & a_Callback) = 0; + virtual bool ForEachEntityInBox(const cBoundingBox & a_Box, const cEntityCallback & a_Callback) = 0; virtual void SetTimeOfDay(int a_TimeOfDay) = 0; |