summaryrefslogtreecommitdiffstats
path: root/src/Protocol
diff options
context:
space:
mode:
author12xx12 <44411062+12xx12@users.noreply.github.com>2020-08-19 21:46:03 +0200
committerGitHub <noreply@github.com>2020-08-19 21:46:03 +0200
commit70ab8d2f9682745dcbff59519a6d5109ecddedd3 (patch)
treeb01da3fb623f3f0b052f06d956463a0028b69658 /src/Protocol
parentAdd statistics upgrade mapping (diff)
downloadcuberite-70ab8d2f9682745dcbff59519a6d5109ecddedd3.tar
cuberite-70ab8d2f9682745dcbff59519a6d5109ecddedd3.tar.gz
cuberite-70ab8d2f9682745dcbff59519a6d5109ecddedd3.tar.bz2
cuberite-70ab8d2f9682745dcbff59519a6d5109ecddedd3.tar.lz
cuberite-70ab8d2f9682745dcbff59519a6d5109ecddedd3.tar.xz
cuberite-70ab8d2f9682745dcbff59519a6d5109ecddedd3.tar.zst
cuberite-70ab8d2f9682745dcbff59519a6d5109ecddedd3.zip
Diffstat (limited to 'src/Protocol')
-rw-r--r--src/Protocol/Protocol_1_13.cpp38
-rw-r--r--src/Protocol/Protocol_1_13.h1
2 files changed, 38 insertions, 1 deletions
diff --git a/src/Protocol/Protocol_1_13.cpp b/src/Protocol/Protocol_1_13.cpp
index f0f2312d2..eced4129e 100644
--- a/src/Protocol/Protocol_1_13.cpp
+++ b/src/Protocol/Protocol_1_13.cpp
@@ -211,7 +211,31 @@ void cProtocol_1_13::SendTabCompletionResults(const AStringVector & a_Results)
void cProtocol_1_13::SendUpdateBlockEntity(cBlockEntity & a_BlockEntity)
{
- // TODO
+ 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;
+ switch (a_BlockEntity.GetBlockType())
+ {
+ 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
+ case E_BLOCK_HEAD: Action = 4; break; // Update Mobhead entity
+ // case E_BLOCK_CONDUIT: Action = 5; break; // Update Conduit entity
+ case E_BLOCK_STANDING_BANNER:
+ case E_BLOCK_WALL_BANNER: Action = 6; break; // Update banner entity
+ // case structure tile entity: Action = 7; break; // Update Structure tile entity
+ case E_BLOCK_END_GATEWAY: Action = 8; break; // Update destination for a end gateway entity
+ case E_BLOCK_SIGN_POST: Action = 9; break; // Update sign entity
+ // 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
+ default: ASSERT(!"Unhandled or unimplemented BlockEntity update request!"); break;
+ }
+ Pkt.WriteBEUInt8(Action);
+
+ WriteBlockEntity(Pkt, a_BlockEntity);
}
@@ -255,6 +279,7 @@ bool cProtocol_1_13::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketTyp
case 0x1b: HandlePacketCraftingBookData(a_ByteBuffer); return true;
case 0x1d: break; // Resource pack status - not yet implemented
case 0x1e: HandlePacketAdvancementTab(a_ByteBuffer); return true;
+ case 0x20: HandlePacketSetBeaconEffect(a_ByteBuffer); return true;
case 0x21: HandlePacketSlotSelect(a_ByteBuffer); return true;
case 0x24: HandlePacketCreativeInventoryAction(a_ByteBuffer); return true;
case 0x26: HandlePacketUpdateSign(a_ByteBuffer); return true;
@@ -296,6 +321,17 @@ void cProtocol_1_13::HandlePacketPluginMessage(cByteBuffer & a_ByteBuffer)
+void cProtocol_1_13::HandlePacketSetBeaconEffect(cByteBuffer & a_ByteBuffer)
+{
+ HANDLE_READ(a_ByteBuffer, ReadVarInt32, UInt32, Effect1);
+ HANDLE_READ(a_ByteBuffer, ReadVarInt32, UInt32, Effect2);
+ m_Client->HandleBeaconSelection(Effect1, Effect2);
+}
+
+
+
+
+
cProtocol::Version cProtocol_1_13::GetProtocolVersion()
{
return Version::Version_1_13;
diff --git a/src/Protocol/Protocol_1_13.h b/src/Protocol/Protocol_1_13.h
index a15b359cc..3c3253cc5 100644
--- a/src/Protocol/Protocol_1_13.h
+++ b/src/Protocol/Protocol_1_13.h
@@ -83,6 +83,7 @@ protected:
virtual bool HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketType) override;
virtual void HandlePacketPluginMessage(cByteBuffer & a_ByteBuffer) override;
+ virtual void HandlePacketSetBeaconEffect(cByteBuffer & a_ByteBuffer);
virtual bool ReadItem(cByteBuffer & a_ByteBuffer, cItem & a_Item, size_t a_KeepRemainingBytes) override;
virtual void WriteItem(cPacketizer & a_Pkt, const cItem & a_Item) override;