Cuberite
A lightweight, fast and extensible game server for Minecraft
ItemMap.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "../Item.h"
5 
6 
7 
8 
9 
11  public cItemHandler
12 {
14 
15  static const unsigned int DEFAULT_RADIUS = 128;
16 
17 public:
19  super(E_ITEM_MAP)
20  {
21  }
22 
23  virtual void OnUpdate(cWorld * a_World, cPlayer * a_Player, const cItem & a_Item)
24  {
25  cMap * Map = a_World->GetMapManager().GetMapData(static_cast<unsigned>(a_Item.m_ItemDamage));
26 
27  if (Map == nullptr)
28  {
29  return;
30  }
31 
32  Map->UpdateRadius(*a_Player, DEFAULT_RADIUS);
33  Map->UpdateClient(a_Player);
34  }
35 } ;
void UpdateClient(cPlayer *a_Player)
Send next update packet to the specified player and remove invalid decorators / clients.
Definition: Map.cpp:181
short m_ItemDamage
Definition: Item.h:211
Encapsulates an in-game world map.
Definition: Map.h:80
Definition: Player.h:27
static const unsigned int DEFAULT_RADIUS
Definition: ItemMap.h:15
cItemHandler super
Definition: ItemMap.h:13
Definition: World.h:65
cMapManager & GetMapManager(void)
Returns the associated map manager instance.
Definition: World.h:886
void UpdateRadius(int a_PixelX, int a_PixelZ, unsigned int a_Radius)
Update a circular region with the specified radius and center (in pixels).
Definition: Map.cpp:69
virtual void OnUpdate(cWorld *a_World, cPlayer *a_Player, const cItem &a_Item)
Called every tick while the item is on the player&#39;s inventory (used by maps, for example) - For now...
Definition: ItemMap.h:23
Definition: Item.h:36
cMap * GetMapData(unsigned int a_ID)
Returns the map with the specified ID, nullptr if out of range.
Definition: MapManager.cpp:58