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 cBedEntity;
8 class cBlockEntity;
10 class cItems;
11 class cPlayer;
12 
17 
18 
19 
20 
22 {
23 public:
24  virtual ~cWorldInterface() {}
25 
26  virtual int GetTimeOfDay(void) const = 0;
27  virtual Int64 GetWorldAge(void) const = 0;
28 
29  virtual eDimension GetDimension(void) const = 0;
30 
32 
33  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;
34 
35  virtual bool DoWithBedAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBedCallback a_Callback) = 0;
36 
38  virtual bool DoWithBlockEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBlockEntityCallback a_Callback) = 0;
39 
41  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;
42 
44  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;
45 
46  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;
47 
50  virtual UInt32 SpawnMob(double a_PosX, double a_PosY, double a_PosZ, eMonsterType a_MonsterType, bool a_Baby) = 0;
51 
54  virtual UInt32 SpawnExperienceOrb(double a_X, double a_Y, double a_Z, int a_Reward) = 0;
55 
58  virtual std::vector<UInt32> SpawnSplitExperienceOrbs(Vector3d a_Pos, int a_Reward) = 0;
59 
61  virtual void SendBlockTo(int a_BlockX, int a_BlockY, int a_BlockZ, cPlayer & a_Player) = 0;
62 
64  virtual bool ForEachPlayer(cPlayerListCallback a_Callback) = 0;
65 
69  virtual bool ForEachEntityInBox(const cBoundingBox & a_Box, cEntityCallback a_Callback) = 0;
70 
71  virtual void SetTimeOfDay(int a_TimeOfDay) = 0;
72 
74  virtual bool IsWeatherWetAt(int a_BlockX, int a_BlockZ) = 0;
75 
77  virtual int GetMinNetherPortalWidth(void) const = 0;
78  virtual int GetMaxNetherPortalWidth(void) const = 0;
79  virtual void SetMinNetherPortalWidth(int a_NewMinWidth) = 0;
80  virtual void SetMaxNetherPortalWidth(int a_NewMaxWidth) = 0;
81 
83  virtual int GetMinNetherPortalHeight(void) const = 0;
84  virtual int GetMaxNetherPortalHeight(void) const = 0;
85  virtual void SetMinNetherPortalHeight(int a_NewMinHeight) = 0;
86  virtual void SetMaxNetherPortalHeight(int a_NewMaxHeight) = 0;
87 
89  virtual int GetHeight(int a_BlockX, int a_BlockZ) = 0;
90 
92  virtual void WakeUpSimulators(Vector3i a_Block) = 0;
93 
94 };
virtual bool DoWithBlockEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBlockEntityCallback a_Callback)=0
Calls the callback for the block entity at the specified coords; returns false if there&#39;s no block en...
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 bool DoWithBedAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBedCallback a_Callback)=0
eDimension
Dimension of a world.
Definition: BlockID.h:1127
virtual Int64 GetWorldAge(void) const =0
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
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.
Definition: Player.h:27
virtual int GetMaxNetherPortalWidth(void) const =0
Represents two sets of coords, minimum and maximum for each direction.
Definition: BoundingBox.h:23
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 GetMinNetherPortalWidth(void) const =0
Returns or sets the minumim or maximum netherportal width.
eMonsterType
Identifies individual monster type, as well as their network type-ID.
Definition: MonsterTypes.h:10
virtual int GetMinNetherPortalHeight(void) const =0
Returns or sets the minumim or maximum netherportal height.
virtual void SetMinNetherPortalHeight(int a_NewMinHeight)=0
virtual void SetMinNetherPortalWidth(int a_NewMinWidth)=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.
virtual void SetMaxNetherPortalWidth(int a_NewMaxWidth)=0
virtual void SetMaxNetherPortalHeight(int a_NewMaxHeight)=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.
eExplosionSource
The source of an explosion.
Definition: BlockID.h:1202
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 std::vector< UInt32 > SpawnSplitExperienceOrbs(Vector3d a_Pos, int a_Reward)=0
Spawns experience orbs of the specified total value at the given location.
virtual int GetTimeOfDay(void) const =0
virtual void WakeUpSimulators(Vector3i a_Block)=0
Wakes up the simulators for the specified block.
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
unsigned int UInt32
Definition: Globals.h:113
virtual ~cWorldInterface()
virtual void SendBlockTo(int a_BlockX, int a_BlockY, int a_BlockZ, cPlayer &a_Player)=0
Sends the block on those coords to the player.
virtual eDimension GetDimension(void) const =0
Definition: Item.h:36
signed long long Int64
Definition: Globals.h:107
virtual cBroadcastInterface & GetBroadcastManager()=0
virtual bool IsWeatherWetAt(int a_BlockX, int a_BlockZ)=0
Returns true if it is raining or storming at the specified location.
This class bridges a vector of cItem for safe access via Lua.
Definition: Item.h:234
virtual int GetMaxNetherPortalHeight(void) const =0