Cuberite
A lightweight, fast and extensible game server for Minecraft
WorldInterface.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "../FunctionRef.h"
5 #include "../Mobs/MonsterTypes.h"
6 
7 class cBlockEntity;
9 class cItems;
10 class cPlayer;
11 
15 
16 
17 
18 
20 {
21 public:
22  virtual ~cWorldInterface() {}
23 
24  virtual cTickTime GetTimeOfDay(void) const = 0;
25  virtual cTickTimeLong GetWorldAge(void) const = 0;
26 
27  virtual eDimension GetDimension(void) const = 0;
28 
30 
31  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;
32 
34  virtual bool DoWithBlockEntityAt(Vector3i a_Position, cBlockEntityCallback a_Callback) = 0;
35 
37  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;
38 
40  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;
41 
42  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;
43 
46  virtual UInt32 SpawnMob(double a_PosX, double a_PosY, double a_PosZ, eMonsterType a_MonsterType, bool a_Baby) = 0;
47 
50  virtual UInt32 SpawnExperienceOrb(double a_X, double a_Y, double a_Z, int a_Reward) = 0;
51 
54  virtual std::vector<UInt32> SpawnSplitExperienceOrbs(Vector3d a_Pos, int a_Reward) = 0;
55 
57  virtual void SendBlockTo(int a_BlockX, int a_BlockY, int a_BlockZ, const cPlayer & a_Player) = 0;
58 
60  inline void SendBlockTo(const Vector3i a_BlockPos, const cPlayer & a_Player)
61  {
62  SendBlockTo(a_BlockPos.x, a_BlockPos.y, a_BlockPos.z, a_Player);
63  }
64 
66  virtual bool ForEachPlayer(cPlayerListCallback a_Callback) = 0;
67 
71  virtual bool ForEachEntityInBox(const cBoundingBox & a_Box, cEntityCallback a_Callback) = 0;
72 
73  virtual void SetTimeOfDay(cTickTime a_TimeOfDay) = 0;
74 
76  virtual bool IsWeatherWetAt(int a_BlockX, int a_BlockZ) = 0;
77 
80  virtual bool IsWeatherWetAtXYZ(Vector3i a_Pos) = 0;
81 
83  virtual int GetMinNetherPortalWidth(void) const = 0;
84  virtual int GetMaxNetherPortalWidth(void) const = 0;
85  virtual void SetMinNetherPortalWidth(int a_NewMinWidth) = 0;
86  virtual void SetMaxNetherPortalWidth(int a_NewMaxWidth) = 0;
87 
89  virtual int GetMinNetherPortalHeight(void) const = 0;
90  virtual int GetMaxNetherPortalHeight(void) const = 0;
91  virtual void SetMinNetherPortalHeight(int a_NewMinHeight) = 0;
92  virtual void SetMaxNetherPortalHeight(int a_NewMaxHeight) = 0;
93 
95  virtual int GetHeight(int a_BlockX, int a_BlockZ) = 0;
96 
98  virtual void WakeUpSimulators(Vector3i a_Block) = 0;
99 
100 };
eDimension
Dimension of a world.
Definition: Defines.h:231
eExplosionSource
The source of an explosion.
Definition: Defines.h:309
std::chrono::duration< signed long long int, cTickTime::period > cTickTimeLong
Definition: Globals.h:367
unsigned int UInt32
Definition: Globals.h:157
std::chrono::duration< signed int, std::ratio_multiply< std::chrono::milliseconds::period, std::ratio< 50 > >> cTickTime
Definition: Globals.h:364
eMonsterType
Identifies individual monster type.
Definition: MonsterTypes.h:11
virtual bool ForEachEntityInBox(const cBoundingBox &a_Box, cEntityCallback a_Callback)=0
Calls the callback for each entity that has a nonempty intersection with the specified boundingbox.
virtual void SetMaxNetherPortalWidth(int a_NewMaxWidth)=0
virtual cBroadcastInterface & GetBroadcastManager()=0
virtual int GetMaxNetherPortalWidth(void) const =0
virtual void WakeUpSimulators(Vector3i a_Block)=0
Wakes up the simulators for the specified block.
virtual void SetMaxNetherPortalHeight(int a_NewMaxHeight)=0
virtual bool IsWeatherWetAt(int a_BlockX, int a_BlockZ)=0
Returns true if it is raining or storming at the specified location.
virtual int GetMinNetherPortalWidth(void) const =0
Returns or sets the minumim or maximum netherportal width.
virtual void SetMinNetherPortalWidth(int a_NewMinWidth)=0
virtual cTickTime GetTimeOfDay(void) const =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
virtual int GetMinNetherPortalHeight(void) const =0
Returns or sets the minumim or maximum netherportal height.
void SendBlockTo(const Vector3i a_BlockPos, const cPlayer &a_Player)
Sends the block on those coords to the player.
virtual UInt32 SpawnMob(double a_PosX, double a_PosY, double a_PosZ, eMonsterType a_MonsterType, bool a_Baby)=0
Spawns a mob of the specified type.
virtual cTickTimeLong GetWorldAge(void) const =0
virtual int GetMaxNetherPortalHeight(void) const =0
virtual void SetMinNetherPortalHeight(int a_NewMinHeight)=0
virtual UInt32 SpawnExperienceOrb(double a_X, double a_Y, double a_Z, int a_Reward)=0
Spawns an experience orb at the given location with the given reward.
virtual void SetTimeOfDay(cTickTime a_TimeOfDay)=0
virtual ~cWorldInterface()
virtual bool ForEachPlayer(cPlayerListCallback a_Callback)=0
Calls the callback for each player in the list; returns true if all players processed,...
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.
virtual bool IsWeatherWetAtXYZ(Vector3i a_Pos)=0
Returns true if it is raining or storming at the specified location, and the rain reaches the specifi...
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
Spawns item pickups for each item in the list.
virtual bool DoWithBlockEntityAt(Vector3i a_Position, cBlockEntityCallback a_Callback)=0
Calls the callback for the block entity at the specified coords; returns false if there's no block en...
virtual std::vector< UInt32 > SpawnSplitExperienceOrbs(Vector3d a_Pos, int a_Reward)=0
Spawns experience orbs of the specified total value at the given location.
virtual void SendBlockTo(int a_BlockX, int a_BlockY, int a_BlockZ, const cPlayer &a_Player)=0
Sends the block on those coords to the player.
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 int GetHeight(int a_BlockX, int a_BlockZ)=0
Returns the world height at the specified coords; waits for the chunk to get loaded / generated.
virtual eDimension GetDimension(void) const =0
Represents two sets of coords, minimum and maximum for each direction.
Definition: BoundingBox.h:24
Definition: Entity.h:76
Definition: Player.h:29
Definition: Item.h:37
This class bridges a vector of cItem for safe access via Lua.
Definition: Item.h:215
T x
Definition: Vector3.h:17
T y
Definition: Vector3.h:17
T z
Definition: Vector3.h:17