summaryrefslogtreecommitdiffstats
path: root/src/Blocks/WorldInterface.h
diff options
context:
space:
mode:
authorAlexander Harkness <me@bearbin.net>2024-11-02 22:27:47 +0100
committerAlexander Harkness <me@bearbin.net>2024-11-02 22:27:47 +0100
commitcb50ec10591c0e0e4b9915e642bc50d3d8d1fd0a (patch)
treef647b20e1823f1846af88e832cf82a4a02e96e69 /src/Blocks/WorldInterface.h
parentImprove clang-format config file, remove automatically enforced code style from contrib guide. (diff)
downloadcuberite-clang-format-codebase.tar
cuberite-clang-format-codebase.tar.gz
cuberite-clang-format-codebase.tar.bz2
cuberite-clang-format-codebase.tar.lz
cuberite-clang-format-codebase.tar.xz
cuberite-clang-format-codebase.tar.zst
cuberite-clang-format-codebase.zip
Diffstat (limited to 'src/Blocks/WorldInterface.h')
-rw-r--r--src/Blocks/WorldInterface.h70
1 files changed, 53 insertions, 17 deletions
diff --git a/src/Blocks/WorldInterface.h b/src/Blocks/WorldInterface.h
index b3fc9878d..404a75407 100644
--- a/src/Blocks/WorldInterface.h
+++ b/src/Blocks/WorldInterface.h
@@ -10,36 +10,72 @@ class cItems;
class cPlayer;
using cBlockEntityCallback = cFunctionRef<bool(cBlockEntity &)>;
-using cPlayerListCallback = cFunctionRef<bool(cPlayer &)>;
-using cEntityCallback = cFunctionRef<bool(cEntity &)>;
+using cPlayerListCallback = cFunctionRef<bool(cPlayer &)>;
+using cEntityCallback = cFunctionRef<bool(cEntity &)>;
class cWorldInterface
{
-public:
+ public:
virtual ~cWorldInterface() {}
virtual cTickTime GetTimeOfDay(void) const = 0;
- virtual cTickTimeLong GetWorldAge(void) const = 0;
+ virtual cTickTimeLong GetWorldAge(void) const = 0;
virtual eDimension GetDimension(void) const = 0;
virtual cBroadcastInterface & GetBroadcastManager() = 0;
- 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;
-
- /** 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 void DoExplosionAt(
+ double a_ExplosionSize,
+ double a_BlockX,
+ double a_BlockY,
+ double a_BlockZ,
+ bool a_CanCauseFire,
+ eExplosionSource a_Source,
+ void * a_SourceData
+ ) = 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(Vector3i a_Position, 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;
-
- /** Spawns item pickups for each item in the list. May compress pickups if too many entities. All pickups get the speed specified. */
- virtual void SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double a_BlockY, double a_BlockZ, double a_SpeedX, double a_SpeedY, double a_SpeedZ, bool IsPlayerCreated = false) = 0;
-
- virtual UInt32 SpawnItemPickup(double a_PosX, double a_PosY, double a_PosZ, const cItem & a_Item, float a_SpeedX = 0.f, float a_SpeedY = 0.f, float a_SpeedZ = 0.f, int a_LifetimeTicks = 6000, bool a_CanCombine = true) = 0;
+ 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;
+
+ /** Spawns item pickups for each item in the list. May compress pickups if too many entities. All pickups get the
+ * speed specified. */
+ virtual void SpawnItemPickups(
+ const cItems & a_Pickups,
+ double a_BlockX,
+ double a_BlockY,
+ double a_BlockZ,
+ double a_SpeedX,
+ double a_SpeedY,
+ double a_SpeedZ,
+ bool IsPlayerCreated = false
+ ) = 0;
+
+ virtual UInt32 SpawnItemPickup(
+ double a_PosX,
+ double a_PosY,
+ double a_PosZ,
+ const cItem & a_Item,
+ float a_SpeedX = 0.f,
+ float a_SpeedY = 0.f,
+ float a_SpeedZ = 0.f,
+ int a_LifetimeTicks = 6000,
+ bool a_CanCombine = true
+ ) = 0;
/** Spawns a mob of the specified type.
Returns the mob's UniqueID if recognized and spawned, or cEntity::INVALID_ID on failure. */
@@ -49,8 +85,8 @@ 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;
- /** Spawns experience orbs of the specified total value at the given location. The orbs' values are split according to regular Minecraft rules.
- Returns an vector of UniqueID of all the orbs. */
+ /** Spawns experience orbs of the specified total value at the given location. The orbs' values are split according
+ to regular Minecraft rules. Returns an vector of UniqueID of all the orbs. */
virtual std::vector<UInt32> SpawnSplitExperienceOrbs(Vector3d a_Pos, int a_Reward) = 0;
/** Sends the block on those coords to the player */
@@ -62,7 +98,8 @@ public:
SendBlockTo(a_BlockPos.x, a_BlockPos.y, a_BlockPos.z, a_Player);
}
- /** Calls the callback for each player in the list; returns true if all players processed, false if the callback aborted by returning true */
+ /** 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(cPlayerListCallback a_Callback) = 0;
/** Calls the callback for each entity that has a nonempty intersection with the specified boundingbox.
@@ -96,5 +133,4 @@ public:
/** Wakes up the simulators for the specified block */
virtual void WakeUpSimulators(Vector3i a_Block) = 0;
-
};