summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol_1_13.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2021-03-15 18:06:58 +0100
committerTiger Wang <ziwei.tiger@outlook.com>2021-03-18 00:44:59 +0100
commite3fe9e5e93fbf8ce26a61719fdb4ccd9a627d37a (patch)
tree81cc0687c9ffd438dff76e646dc81a5a6b54377f /src/Protocol/Protocol_1_13.cpp
parentMob heads, banners cannot be used (diff)
downloadcuberite-e3fe9e5e93fbf8ce26a61719fdb4ccd9a627d37a.tar
cuberite-e3fe9e5e93fbf8ce26a61719fdb4ccd9a627d37a.tar.gz
cuberite-e3fe9e5e93fbf8ce26a61719fdb4ccd9a627d37a.tar.bz2
cuberite-e3fe9e5e93fbf8ce26a61719fdb4ccd9a627d37a.tar.lz
cuberite-e3fe9e5e93fbf8ce26a61719fdb4ccd9a627d37a.tar.xz
cuberite-e3fe9e5e93fbf8ce26a61719fdb4ccd9a627d37a.tar.zst
cuberite-e3fe9e5e93fbf8ce26a61719fdb4ccd9a627d37a.zip
Diffstat (limited to 'src/Protocol/Protocol_1_13.cpp')
-rw-r--r--src/Protocol/Protocol_1_13.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/Protocol/Protocol_1_13.cpp b/src/Protocol/Protocol_1_13.cpp
index 77cf86333..b892e8433 100644
--- a/src/Protocol/Protocol_1_13.cpp
+++ b/src/Protocol/Protocol_1_13.cpp
@@ -29,6 +29,7 @@ Implements the 1.13 protocol classes:
#include "../Server.h"
#include "../World.h"
#include "../JsonUtils.h"
+#include "../WorldStorage/FastNBT.h"
#include "../Bindings/PluginManager.h"
@@ -200,13 +201,13 @@ void cProtocol_1_13::SendTabCompletionResults(const AStringVector & a_Results)
void cProtocol_1_13::SendUpdateBlockEntity(cBlockEntity & a_BlockEntity)
{
ASSERT(m_State == 3); // In game mode?
- cPacketizer Pkt(*this, pktUpdateBlockEntity);
-
- Pkt.WriteXYZPosition64(a_BlockEntity.GetPosX(), a_BlockEntity.GetPosY(), a_BlockEntity.GetPosZ());
- Byte Action = 0;
+ Byte Action;
switch (a_BlockEntity.GetBlockType())
{
+ case E_BLOCK_ENCHANTMENT_TABLE: Action = 0; break; // The ones with a action of 0 is just a workaround to send the block entities to a client.
+ case E_BLOCK_END_PORTAL: Action = 0; break; // Todo: 18.09.2020 - remove this when block entities are transmitted in the ChunkData packet - 12xx12
+
case E_BLOCK_MOB_SPAWNER: Action = 1; break; // Update mob spawner spinny mob thing
case E_BLOCK_COMMAND_BLOCK: Action = 2; break; // Update command block text
case E_BLOCK_BEACON: Action = 3; break; // Update beacon entity
@@ -220,14 +221,17 @@ void cProtocol_1_13::SendUpdateBlockEntity(cBlockEntity & a_BlockEntity)
// case E_BLOCK_SHULKER_BOX: Action = 10; break; // sets shulker box - not used just here if anyone is confused from reading the protocol wiki
case E_BLOCK_BED: Action = 11; break; // Update bed color
- case E_BLOCK_ENCHANTMENT_TABLE: Action = 0; break; // The ones with a action of 0 is just a workaround to send the block entities to a client.
- case E_BLOCK_END_PORTAL: Action = 0; break; // Todo: 18.09.2020 - remove this when block entities are transmitted in the ChunkData packet - 12xx12
-
- default: ASSERT(!"Unhandled or unimplemented BlockEntity update request!"); break;
+ default: return; // Block entities change between versions
}
+
+ cPacketizer Pkt(*this, pktUpdateBlockEntity);
+ Pkt.WriteXYZPosition64(a_BlockEntity.GetPosX(), a_BlockEntity.GetPosY(), a_BlockEntity.GetPosZ());
Pkt.WriteBEUInt8(Action);
- WriteBlockEntity(Pkt, a_BlockEntity);
+ cFastNBTWriter Writer;
+ WriteBlockEntity(Writer, a_BlockEntity);
+ Writer.Finish();
+ Pkt.WriteBuf(Writer.GetResult());
}
@@ -1361,6 +1365,7 @@ void cProtocol_1_13_1::SendBossBarAdd(UInt32 a_UniqueID, const cCompositeChat &
case BossBarColor::Purple: return 5U;
case BossBarColor::White: return 6U;
}
+ UNREACHABLE("Unsupported boss bar property");
}());
Pkt.WriteVarInt32([a_DivisionType]
{
@@ -1372,6 +1377,7 @@ void cProtocol_1_13_1::SendBossBarAdd(UInt32 a_UniqueID, const cCompositeChat &
case BossBarDivisionType::TwelveNotches: return 3U;
case BossBarDivisionType::TwentyNotches: return 4U;
}
+ UNREACHABLE("Unsupported boss bar property");
}());
{
UInt8 Flags = 0x00;