Cuberite
A lightweight, fast and extensible game server for Minecraft
Protocol_1_13.cpp
Go to the documentation of this file.
1 
2 // Protocol_1_13.cpp
3 
4 /*
5 Implements the 1.13 protocol classes:
6 - release 1.13 protocol (#393)
7 */
8 
9 #include "Globals.h"
10 #include "Protocol_1_13.h"
11 #include "ProtocolRecognizer.h"
12 #include "ChunkDataSerializer.h"
13 #include "Packetizer.h"
14 #include "ProtocolPalettes.h"
15 
16 #include "../Entities/Boat.h"
17 #include "../Entities/Minecart.h"
18 #include "../Entities/Pickup.h"
19 #include "../Entities/Player.h"
20 #include "../Entities/ItemFrame.h"
21 #include "../Entities/ArrowEntity.h"
22 #include "../Entities/FireworkEntity.h"
23 #include "../Entities/SplashPotionEntity.h"
24 
25 #include "../BlockTypePalette.h"
26 #include "../ClientHandle.h"
27 #include "../Root.h"
28 #include "../Server.h"
29 
30 #include "../Bindings/PluginManager.h"
31 
32 
33 
34 
35 
36 #define HANDLE_READ(ByteBuf, Proc, Type, Var) \
37  Type Var; \
38  do { \
39  if (!ByteBuf.Proc(Var))\
40  {\
41  return;\
42  } \
43  } while (false)
44 
45 
46 
47 
48 
49 #define HANDLE_PACKET_READ(ByteBuf, Proc, Type, Var) \
50  Type Var; \
51  do { \
52  { \
53  if (!ByteBuf.Proc(Var)) \
54  { \
55  ByteBuf.CheckValid(); \
56  return false; \
57  } \
58  ByteBuf.CheckValid(); \
59  } \
60  } while (false)
61 
62 
63 
64 
65 
66 cProtocol_1_13::cProtocol_1_13(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State) :
67  Super(a_Client, a_ServerAddress, a_ServerPort, a_State)
68 {
69 }
70 
71 
72 
73 
74 
76 {
77  // Get the palettes; fail if not available:
78  auto paletteVersion = this->GetPaletteVersion();
80  if (m_BlockTypePalette == nullptr)
81  {
82  throw std::runtime_error(Printf("This server doesn't support protocol %s.", paletteVersion));
83  }
84 
85  // Process the palette into the temporary BLOCKTYPE -> NetBlockID map:
86  auto upg = cRoot::Get()->GetUpgradeBlockTypePalette();
87  m_BlockTypeMap = m_BlockTypePalette->createTransformMapWithFallback(upg, 0);
88 }
89 
90 
91 
92 
93 
95 {
96  switch (a_PacketType)
97  {
98  case pktAttachEntity: return 0x40;
99  case pktBlockChanges: return 0x0f;
100  case pktCameraSetTo: return 0x3c;
101  case pktChatRaw: return 0x0e;
102  case pktCollectEntity: return 0x4f;
103  case pktDestroyEntity: return 0x35;
104  case pktDisconnectDuringGame: return 0x1b;
105  case pktEditSign: return 0x2c;
106  case pktEntityEffect: return 0x53;
107  case pktEntityEquipment: return 0x42;
108  case pktEntityHeadLook: return 0x39;
109  case pktEntityLook: return 0x2a;
110  case pktEntityMeta: return 0x3f;
111  case pktEntityProperties: return 0x52;
112  case pktEntityRelMove: return 0x28;
113  case pktEntityRelMoveLook: return 0x29;
114  case pktEntityStatus: return 0x1c;
115  case pktEntityVelocity: return 0x41;
116  case pktExperience: return 0x43;
117  case pktExplosion: return 0x1e;
118  case pktGameMode: return 0x20;
119  case pktHeldItemChange: return 0x3d;
120  case pktInventorySlot: return 0x17;
121  case pktJoinGame: return 0x25;
122  case pktKeepAlive: return 0x21;
123  case pktMapData: return 0x26;
124  case pktParticleEffect: return 0x24;
125  case pktPlayerAbilities: return 0x2e;
126  case pktPlayerList: return 0x30;
127  case pktPlayerMaxSpeed: return 0x52;
128  case pktPlayerMoveLook: return 0x32;
129  case pktPluginMessage: return 0x19;
130  case pktRemoveEntityEffect: return 0x36;
131  case pktRespawn: return 0x38;
132  case pktScoreboardObjective: return 0x45;
133  case pktSoundEffect: return 0x1a;
134  case pktSoundParticleEffect: return 0x23;
135  case pktSpawnPosition: return 0x49;
136  case pktTabCompletionResults: return 0x10;
137  case pktTeleportEntity: return 0x50;
138  case pktTimeUpdate: return 0x4a;
139  case pktTitle: return 0x4b;
140  case pktUnloadChunk: return 0x1f;
141  case pktUpdateHealth: return 0x44;
142  case pktUpdateScore: return 0x48;
144  case pktUseBed: return 0x33;
145  case pktWindowClose: return 0x13;
146  case pktWindowItems: return 0x15;
147  case pktWindowOpen: return 0x14;
148  case pktWindowProperty: return 0x16;
149  default: return Super::GetPacketID(a_PacketType);
150  }
151 }
152 
153 
154 
155 
156 
158 {
159  return "1.13";
160 }
161 
162 
163 
164 
165 
166 bool cProtocol_1_13::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketType)
167 {
168  if (m_State != 3)
169  {
170  return Super::HandlePacket(a_ByteBuffer, a_PacketType);
171  }
172 
173  // Game
174  switch (a_PacketType)
175  {
176  case 0x00: HandleConfirmTeleport(a_ByteBuffer); return true;
177  case 0x05: HandlePacketTabComplete(a_ByteBuffer); return true;
178  case 0x02: HandlePacketChatMessage(a_ByteBuffer); return true;
179  case 0x03: HandlePacketClientStatus(a_ByteBuffer); return true;
180  case 0x04: HandlePacketClientSettings(a_ByteBuffer); return true;
181  case 0x06: break; // Confirm transaction - not used in Cuberite
182  case 0x07: HandlePacketEnchantItem(a_ByteBuffer); return true;
183  case 0x08: HandlePacketWindowClick(a_ByteBuffer); return true;
184  case 0x09: HandlePacketWindowClose(a_ByteBuffer); return true;
185  case 0x0a: HandlePacketPluginMessage(a_ByteBuffer); return true;
186  case 0x0d: HandlePacketUseEntity(a_ByteBuffer); return true;
187  case 0x0e: HandlePacketKeepAlive(a_ByteBuffer); return true;
188  case 0x0f: HandlePacketPlayer(a_ByteBuffer); return true;
189  case 0x10: HandlePacketPlayerPos(a_ByteBuffer); return true;
190  case 0x11: HandlePacketPlayerPosLook(a_ByteBuffer); return true;
191  case 0x12: HandlePacketPlayerLook(a_ByteBuffer); return true;
192  case 0x13: HandlePacketVehicleMove(a_ByteBuffer); return true;
193  case 0x14: HandlePacketBoatSteer(a_ByteBuffer); return true;
194  case 0x15: break; // Pick item - not yet implemented
195  case 0x16: break; // Craft Recipe Request - not yet implemented
196  case 0x17: HandlePacketPlayerAbilities(a_ByteBuffer); return true;
197  case 0x18: HandlePacketBlockDig(a_ByteBuffer); return true;
198  case 0x19: HandlePacketEntityAction(a_ByteBuffer); return true;
199  case 0x1a: HandlePacketSteerVehicle(a_ByteBuffer); return true;
200  case 0x1b: HandlePacketCraftingBookData(a_ByteBuffer); return true;
201  case 0x1d: break; // Resource pack status - not yet implemented
202  case 0x1e: HandlePacketAdvancementTab(a_ByteBuffer); return true;
203  case 0x21: HandlePacketSlotSelect(a_ByteBuffer); return true;
204  case 0x24: HandlePacketCreativeInventoryAction(a_ByteBuffer); return true;
205  case 0x26: HandlePacketUpdateSign(a_ByteBuffer); return true;
206  case 0x27: HandlePacketAnimation(a_ByteBuffer); return true;
207  case 0x28: HandlePacketSpectate(a_ByteBuffer); return true;
208  case 0x29: HandlePacketBlockPlace(a_ByteBuffer); return true;
209  case 0x2a: HandlePacketUseItem(a_ByteBuffer); return true;
210  }
211 
212  return Super::HandlePacket(a_ByteBuffer, a_PacketType);
213 }
214 
215 
216 
217 
218 
220 {
221  cServer * Server = cRoot::Get()->GetServer();
222  AString ServerDescription = Server->GetDescription();
223  auto NumPlayers = static_cast<signed>(Server->GetNumPlayers());
224  auto MaxPlayers = static_cast<signed>(Server->GetMaxPlayers());
225  AString Favicon = Server->GetFaviconData();
226  cRoot::Get()->GetPluginManager()->CallHookServerPing(*m_Client, ServerDescription, NumPlayers, MaxPlayers, Favicon);
227 
228  // Version:
229  Json::Value Version;
230  Version["name"] = "Cuberite 1.13";
231  Version["protocol"] = cProtocolRecognizer::PROTO_VERSION_1_13;
232 
233  // Players:
234  Json::Value Players;
235  Players["online"] = NumPlayers;
236  Players["max"] = MaxPlayers;
237  // TODO: Add "sample"
238 
239  // Description:
240  Json::Value Description;
241  Description["text"] = ServerDescription.c_str();
242 
243  // Create the response:
244  Json::Value ResponseValue;
245  ResponseValue["version"] = Version;
246  ResponseValue["players"] = Players;
247  ResponseValue["description"] = Description;
248  m_Client->ForgeAugmentServerListPing(ResponseValue);
249  if (!Favicon.empty())
250  {
251  ResponseValue["favicon"] = Printf("data:image/png;base64,%s", Favicon.c_str());
252  }
253 
254  // Serialize the response into a packet:
255  Json::FastWriter Writer;
256  cPacketizer Pkt(*this, pktStatusResponse);
257  Pkt.WriteString(Writer.write(ResponseValue));
258 }
259 
260 
261 
262 
263 
265 {
266  HANDLE_READ(a_ByteBuffer, ReadVarUTF8String, AString, Channel);
267 
268  // If the plugin channel is recognized vanilla, handle it directly:
269  if (Channel.substr(0, 15) == "minecraft:brand")
270  {
271  HANDLE_READ(a_ByteBuffer, ReadVarUTF8String, AString, Brand);
272  m_Client->SetClientBrand(Brand);
273 
274  // Send back our brand, including the length:
275  SendPluginMessage("minecraft:brand", "\x08""Cuberite");
276  return;
277  }
278 
279  // Read the plugin message and relay to clienthandle:
280  AString Data;
281  VERIFY(a_ByteBuffer.ReadString(Data, a_ByteBuffer.GetReadableSpace() - 1)); // Always succeeds
282  m_Client->HandlePluginMessage(Channel, Data);
283 }
284 
285 
286 
287 
288 
289 void cProtocol_1_13::SendBlockChange(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
290 {
291  ASSERT(m_State == 3); // In game mode?
292 
293  cPacketizer Pkt(*this, pktBlockChange);
294  Pkt.WritePosition64(a_BlockX, a_BlockY, a_BlockZ);
295  Pkt.WriteVarInt32(static_cast<UInt32>(a_BlockType)); // TODO: Palette
296 }
297 
298 
299 
300 
301 
302 void cProtocol_1_13::SendBlockChanges(int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes)
303 {
304  ASSERT(m_State == 3); // In game mode?
305 
306  cPacketizer Pkt(*this, pktBlockChanges);
307  Pkt.WriteBEInt32(a_ChunkX);
308  Pkt.WriteBEInt32(a_ChunkZ);
309  Pkt.WriteVarInt32(static_cast<UInt32>(a_Changes.size()));
310  for (sSetBlockVector::const_iterator itr = a_Changes.begin(), end = a_Changes.end(); itr != end; ++itr)
311  {
312  Int16 Coords = static_cast<Int16>(itr->m_RelY | (itr->m_RelZ << 8) | (itr->m_RelX << 12));
313  Pkt.WriteBEInt16(Coords);
314  Pkt.WriteVarInt32(static_cast<UInt32>(itr->m_BlockType)); // TODO: Palette
315  } // for itr - a_Changes[]
316 }
317 
318 
319 
320 
321 
322 void cProtocol_1_13::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer)
323 {
324  ASSERT(m_State == 3); // In game mode?
325 
326  const AString & ChunkData = a_Serializer.Serialize(cChunkDataSerializer::RELEASE_1_13, a_ChunkX, a_ChunkZ, m_BlockTypeMap);
327  cCSLock Lock(m_CSPacket);
328  SendData(ChunkData.data(), ChunkData.size());
329 }
330 
331 
332 
333 
334 
335 void cProtocol_1_13::SendMapData(const cMap & a_Map, int a_DataStartX, int a_DataStartY)
336 {
337  // TODO
338 }
339 
340 
341 
342 
343 
345 {
346  // TODO
347 }
348 
349 
350 
351 
352 
353 void cProtocol_1_13::SendParticleEffect(const AString & a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount)
354 {
355  // TODO
356 }
357 
358 
359 
360 
361 
362 void cProtocol_1_13::SendParticleEffect(const AString & a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, std::array<int, 2> a_Data)
363 {
364  // TODO
365 }
366 
367 
368 
369 
370 
371 void cProtocol_1_13::SendPluginMessage(const AString & a_Channel, const AString & a_Message)
372 {
373  // TODO
374 }
375 
376 
377 
378 
379 
380 void cProtocol_1_13::SendScoreboardObjective(const AString & a_Name, const AString & a_DisplayName, Byte a_Mode)
381 {
382  // TODO
383 }
384 
385 
386 
387 
388 
389 void cProtocol_1_13::SendSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch)
390 {
391  // TODO
392 }
393 
394 
395 
396 
397 
399 {
400  // TODO
401 }
402 
403 
404 
405 
406 
408 {
409  // TODO
410 }
411 
412 
413 
414 
415 
417 {
418  // TODO
419 }
420 
421 
422 
423 
424 
425 bool cProtocol_1_13::ReadItem(cByteBuffer & a_ByteBuffer, cItem & a_Item, size_t a_KeepRemainingBytes)
426 {
427  HANDLE_PACKET_READ(a_ByteBuffer, ReadBEInt16, Int16, ItemType);
428  if (ItemType == -1)
429  {
430  // The item is empty, no more data follows
431  a_Item.Empty();
432  return true;
433  }
434  a_Item.m_ItemType = ItemType;
435 
436  HANDLE_PACKET_READ(a_ByteBuffer, ReadBEInt8, Int8, ItemCount);
437  a_Item.m_ItemCount = ItemCount;
438  a_Item.m_ItemDamage = 0; // o no, no more damage in 1.13
439  if (ItemCount <= 0)
440  {
441  a_Item.Empty();
442  }
443 
445  if (!a_ByteBuffer.ReadString(Metadata, a_ByteBuffer.GetReadableSpace() - a_KeepRemainingBytes - 1) || (Metadata.size() == 0) || (Metadata[0] == 0))
446  {
447  // No metadata
448  return true;
449  }
450 
451  ParseItemMetadata(a_Item, Metadata);
452  return true;
453 }
454 
455 
456 
457 
458 
459 void cProtocol_1_13::WriteItem(cPacketizer & a_Pkt, const cItem & a_Item)
460 {
461  short ItemType = a_Item.m_ItemType;
462  ASSERT(ItemType >= -1); // Check validity of packets in debug runtime
463  if (ItemType <= 0)
464  {
465  // Fix, to make sure no invalid values are sent.
466  ItemType = -1;
467  }
468 
469  if (a_Item.IsEmpty())
470  {
471  a_Pkt.WriteBEInt16(-1);
472  return;
473  }
474 
475  // Normal item
476  // TODO: use new item ids
477  a_Pkt.WriteBEInt16(ItemType);
478  a_Pkt.WriteBEInt8(a_Item.m_ItemCount);
479 
480  // TODO: NBT
481  a_Pkt.WriteBEInt8(0);
482 }
483 
484 
485 
486 
487 
489 {
490  // TODO: Investigate
491 }
virtual void SendParticleEffect(const AString &a_ParticleName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount) override
virtual void SendMapData(const cMap &a_Map, int a_DataStartX, int a_DataStartY) override
virtual void WriteItem(cPacketizer &a_Pkt, const cItem &a_Item) override
Writes the item data into a packet.
virtual void HandlePacketEnchantItem(cByteBuffer &a_ByteBuffer)
virtual void HandlePacketPlayerLook(cByteBuffer &a_ByteBuffer)
virtual void HandlePacketPlayer(cByteBuffer &a_ByteBuffer)
UInt32 m_State
State of the protocol.
Definition: Protocol_1_9.h:154
virtual void HandlePacketUpdateSign(cByteBuffer &a_ByteBuffer)
void WriteBEInt8(Int8 a_Value)
Definition: Packetizer.h:56
virtual void SendBlockChange(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override
virtual void SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializer &a_Serializer) override
void ParseItemMetadata(cItem &a_Item, const AString &a_Metadata)
Parses item metadata as read by ReadItem(), into the item enchantments.
size_t GetReadableSpace(void) const
Returns the number of bytes that are currently available for reading (may be less than UsedSpace due ...
Definition: ByteBuffer.cpp:194
virtual void SendData(const char *a_Data, size_t a_Size) override
Sends the data to the client, encrypting them if needed.
virtual UInt32 GetPacketID(ePacketType a_PacketType) override
Get the packet ID for a given packet.
virtual void HandlePacketPluginMessage(cByteBuffer &a_ByteBuffer) override
Class that manages the statistics and achievements of a single player.
Definition: Statistics.h:127
#define VERIFY(x)
Definition: Globals.h:339
cProtocol_1_13(cClientHandle *a_Client, const AString &a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State)
short m_ItemDamage
Definition: Item.h:211
virtual void Initialize(cClientHandle &a_Client) override
Called after construction so that the protocol class can initialize itself.
signed char Int8
Definition: Globals.h:110
virtual void SendSoundEffect(const AString &a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) override
signed short Int16
Definition: Globals.h:109
virtual void SendBlockChanges(int a_ChunkX, int a_ChunkZ, const sSetBlockVector &a_Changes) override
virtual void HandlePacketBlockDig(cByteBuffer &a_ByteBuffer)
unsigned char BLOCKTYPE
The datatype used by blockdata.
Definition: ChunkDef.h:42
virtual void HandlePacketPlayerPosLook(cByteBuffer &a_ByteBuffer)
Encapsulates an in-game world map.
Definition: Map.h:80
virtual void HandlePacketBoatSteer(cByteBuffer &a_ByteBuffer)
cCriticalSection m_CSPacket
Provides synchronization for sending the entire packet at once.
Definition: Protocol.h:249
virtual void HandlePacketClientStatus(cByteBuffer &a_ByteBuffer)
bool ReadString(AString &a_String, size_t a_Count)
Reads a_Count bytes into a_String; returns true if successful.
Definition: ByteBuffer.cpp:799
bool IsEmpty(void) const
Definition: Item.h:116
virtual void HandlePacketWindowClick(cByteBuffer &a_ByteBuffer)
void WriteBEInt16(Int16 a_Value)
Definition: Packetizer.h:62
virtual void SendScoreboardObjective(const AString &a_Name, const AString &a_DisplayName, Byte a_Mode) override
virtual void HandlePacketPlayerAbilities(cByteBuffer &a_ByteBuffer)
virtual void HandlePacketClientSettings(cByteBuffer &a_ByteBuffer)
bool CallHookServerPing(cClientHandle &a_ClientHandle, AString &a_ServerDescription, int &a_OnlinePlayersCount, int &a_MaxPlayersCount, AString &a_Favicon)
ProtocolPalettes & GetProtocolPalettes() const
Returns the per-protocol palettes manager.
Definition: Root.h:101
virtual void HandlePacketUseItem(cByteBuffer &a_ByteBuffer)
const AString & GetDescription(void) const
Definition: Server.h:65
virtual void SendPaintingSpawn(const cPainting &a_Painting) override
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
Definition: ChunkDef.h:45
void WriteString(const AString &a_Value)
Definition: Packetizer.h:116
virtual void HandlePacketStatusRequest(cByteBuffer &a_ByteBuffer) override
The version 110 protocol, used by 1.9.3 and 1.9.4.
Definition: Protocol_1_9.h:326
const AString & GetFaviconData(void) const
Returns base64 encoded favicon data (obtained from favicon.png)
Definition: Server.h:129
void WriteBEInt32(Int32 a_Value)
Definition: Packetizer.h:74
cClientHandle * m_Client
Definition: Protocol.h:244
virtual void SendTabCompletionResults(const AStringVector &a_Results) override
virtual void HandlePacketVehicleMove(cByteBuffer &a_ByteBuffer)
virtual void HandlePacketSteerVehicle(cByteBuffer &a_ByteBuffer)
#define HANDLE_READ(ByteBuf, Proc, Type, Var)
std::shared_ptr< const BlockTypePalette > blockTypePalette(const AString &aProtocolVersion) const
Returns the BlockTypePalette for the specified protocol.
virtual void HandlePacketTabComplete(cByteBuffer &a_ByteBuffer)
#define HANDLE_PACKET_READ(ByteBuf, Proc, Type, Var)
Definition: Server.h:55
std::vector< AString > AStringVector
Definition: StringUtils.h:14
virtual void HandlePacketChatMessage(cByteBuffer &a_ByteBuffer)
virtual void HandlePacketBlockPlace(cByteBuffer &a_ByteBuffer) override
size_t GetMaxPlayers(void) const
Definition: Server.h:70
virtual void HandleConfirmTeleport(cByteBuffer &a_ByteBuffer)
virtual void WriteEntityMetadata(cPacketizer &a_Pkt, const cEntity &a_Entity) override
Writes the metadata for the specified entity, not including the terminating 0xff. ...
virtual void HandlePacketSpectate(cByteBuffer &a_ByteBuffer)
const BlockTypePalette & GetUpgradeBlockTypePalette() const
Returns the block type palette used for upgrading blocks from pre-1.13 data.
Definition: Root.h:98
Serializes one chunk&#39;s data to (possibly multiple) protocol versions.
char m_ItemCount
Definition: Item.h:210
virtual void HandlePacketAnimation(cByteBuffer &a_ByteBuffer)
AString & Printf(AString &str, const char *format, fmt::ArgList args)
Output the formatted text into the string.
Definition: StringUtils.cpp:55
void SetClientBrand(const AString &a_ClientBrand)
Called by the protocol when it receives the MC|Brand plugin message.
Definition: ClientHandle.h:256
#define ASSERT(x)
Definition: Globals.h:335
virtual void SendStatistics(const cStatManager &a_Manager) override
size_t GetNumPlayers(void) const
Definition: Server.h:71
An object that can store incoming bytes and lets its clients read the bytes sequentially The bytes ar...
Definition: ByteBuffer.h:29
void Empty(void)
Definition: Item.h:92
void HandlePluginMessage(const AString &a_Channel, const AString &a_Message)
virtual void SendPluginMessage(const AString &a_Channel, const AString &a_Message) override
virtual UInt32 GetPacketID(ePacketType a_Packet) override
Get the packet ID for a given packet.
const AString & Serialize(int a_Version, int a_ChunkX, int a_ChunkZ, const std::map< UInt32, UInt32 > &a_BlockTypeMap)
Serializes the contained chunk data into the specified protocol version.
std::shared_ptr< const BlockTypePalette > m_BlockTypePalette
The palette used to transform internal block type palette into the protocol-specific ID...
Definition: Protocol_1_13.h:44
unsigned short UInt16
Definition: Globals.h:114
virtual void HandlePacketCraftingBookData(cByteBuffer &a_ByteBuffer)
std::string AString
Definition: StringUtils.h:13
virtual bool ReadItem(cByteBuffer &a_ByteBuffer, cItem &a_Item, size_t a_KeepRemainingBytes) override
Reads an item out of the received data, sets a_Item to the values read.
std::map< UInt32, UInt32 > m_BlockTypeMap
Temporary hack for initial 1.13+ support while keeping BLOCKTYPE data: Map of the BLOCKTYPE::META to ...
Definition: Protocol_1_13.h:48
cServer * GetServer(void)
Definition: Root.h:69
virtual bool HandlePacket(cByteBuffer &a_ByteBuffer, UInt32 a_PacketType) override
Reads and handles the packet.
virtual void HandlePacketUseEntity(cByteBuffer &a_ByteBuffer)
Composes an individual packet in the protocol&#39;s m_OutPacketBuffer; sends it just before being destruc...
Definition: Packetizer.h:28
void ForgeAugmentServerListPing(Json::Value &a_Response)
Add the Forge mod list to the server ping response.
Definition: ClientHandle.h:270
static cRoot * Get()
Definition: Root.h:51
void WritePosition64(int a_BlockX, int a_BlockY, int a_BlockZ)
Writes the specified block position as a single encoded 64-bit BigEndian integer. ...
Definition: Packetizer.h:129
void WriteVarInt32(UInt32 a_Value)
Definition: Packetizer.h:110
Definition: Entity.h:73
RAII for cCriticalSection - locks the CS on creation, unlocks on destruction.
unsigned int UInt32
Definition: Globals.h:113
virtual void HandlePacketPlayerPos(cByteBuffer &a_ByteBuffer)
unsigned char Byte
Definition: Globals.h:117
short m_ItemType
Definition: Item.h:209
virtual void HandlePacketWindowClose(cByteBuffer &a_ByteBuffer)
virtual AString GetPaletteVersion() const
Returns the string identifying the palettes&#39; version, such as "1.13" or "1.14.4". ...
virtual void SendUpdateBlockEntity(cBlockEntity &a_BlockEntity) override
ePacketType
Logical types of outgoing packets.
Definition: Protocol.h:68
Definition: Item.h:36
virtual void HandlePacketKeepAlive(cByteBuffer &a_ByteBuffer) override
virtual bool HandlePacket(cByteBuffer &a_ByteBuffer, UInt32 a_PacketType) override
Reads and handles the packet.
std::vector< sSetBlock > sSetBlockVector
Definition: ChunkDef.h:564
virtual void HandlePacketSlotSelect(cByteBuffer &a_ByteBuffer)
cPluginManager * GetPluginManager(void)
Definition: Root.h:114
virtual void HandlePacketAdvancementTab(cByteBuffer &a_ByteBuffer)
virtual void HandlePacketCreativeInventoryAction(cByteBuffer &a_ByteBuffer)
virtual void HandlePacketEntityAction(cByteBuffer &a_ByteBuffer)