diff options
author | 12xx12 <44411062+12xx12@users.noreply.github.com> | 2020-10-29 21:47:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-29 21:47:20 +0100 |
commit | 961d5eb420182add0b6cb4d92f260b885563389c (patch) | |
tree | c63fb7b3905d2ae59c539cca44845984128c27bb /src/Protocol | |
parent | Remove BLOCKENTITY_PROTODEF (diff) | |
download | cuberite-961d5eb420182add0b6cb4d92f260b885563389c.tar cuberite-961d5eb420182add0b6cb4d92f260b885563389c.tar.gz cuberite-961d5eb420182add0b6cb4d92f260b885563389c.tar.bz2 cuberite-961d5eb420182add0b6cb4d92f260b885563389c.tar.lz cuberite-961d5eb420182add0b6cb4d92f260b885563389c.tar.xz cuberite-961d5eb420182add0b6cb4d92f260b885563389c.tar.zst cuberite-961d5eb420182add0b6cb4d92f260b885563389c.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Protocol/Packetizer.h | 7 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_10.cpp | 17 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_11.cpp | 17 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_12.cpp | 17 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_13.cpp | 15 | ||||
-rw-r--r-- | src/Protocol/Protocol_1_9.cpp | 16 |
6 files changed, 89 insertions, 0 deletions
diff --git a/src/Protocol/Packetizer.h b/src/Protocol/Packetizer.h index 22ef01ed9..b2f2b11f4 100644 --- a/src/Protocol/Packetizer.h +++ b/src/Protocol/Packetizer.h @@ -133,6 +133,13 @@ public: } /** Writes the specified block position as a single encoded 64-bit BigEndian integer. + The three coordinates are written in XYZ order. */ + inline void WriteXYZPosition64(const Vector3i & a_Pos) + { + VERIFY(m_Out.WriteXYZPosition64(a_Pos.x, a_Pos.y, a_Pos.z)); + } + + /** Writes the specified block position as a single encoded 64-bit BigEndian integer. The three coordinates are written in XZY order, in 1.14+. */ inline void WriteXZYPosition64(int a_BlockX, int a_BlockY, int a_BlockZ) { diff --git a/src/Protocol/Protocol_1_10.cpp b/src/Protocol/Protocol_1_10.cpp index f40bf7b73..d1b48c11a 100644 --- a/src/Protocol/Protocol_1_10.cpp +++ b/src/Protocol/Protocol_1_10.cpp @@ -21,6 +21,7 @@ Implements the 1.10 protocol classes: #include "../WorldStorage/FastNBT.h" #include "../Entities/Boat.h" +#include "../Entities/EnderCrystal.h" #include "../Entities/ExpOrb.h" #include "../Entities/Minecart.h" #include "../Entities/FallingBlock.h" @@ -539,6 +540,22 @@ void cProtocol_1_10_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & break; } // case etItemFrame + case cEntity::etEnderCrystal: + { + const auto & EnderCrystal = static_cast<const cEnderCrystal &>(a_Entity); + a_Pkt.WriteBEUInt8(7); + a_Pkt.WriteBEUInt8(METADATA_TYPE_OPTIONAL_POSITION); + a_Pkt.WriteBool(EnderCrystal.DisplaysBeam()); + if (EnderCrystal.DisplaysBeam()) + { + a_Pkt.WriteXYZPosition64(EnderCrystal.GetBeamTarget()); + } + a_Pkt.WriteBEUInt8(8); + a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL); + a_Pkt.WriteBool(EnderCrystal.ShowsBottom()); + break; + } // case etEnderCrystal + default: { break; diff --git a/src/Protocol/Protocol_1_11.cpp b/src/Protocol/Protocol_1_11.cpp index 1e07419ec..9ea6332b8 100644 --- a/src/Protocol/Protocol_1_11.cpp +++ b/src/Protocol/Protocol_1_11.cpp @@ -16,6 +16,7 @@ Implements the 1.11 protocol classes: #include "../WorldStorage/FastNBT.h" #include "../Entities/Boat.h" +#include "../Entities/EnderCrystal.h" #include "../Entities/ExpOrb.h" #include "../Entities/Minecart.h" #include "../Entities/FallingBlock.h" @@ -805,6 +806,22 @@ void cProtocol_1_11_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & break; } // case etItemFrame + case cEntity::etEnderCrystal: + { + const auto & EnderCrystal = static_cast<const cEnderCrystal &>(a_Entity); + a_Pkt.WriteBEUInt8(7); + a_Pkt.WriteBEUInt8(METADATA_TYPE_OPTIONAL_POSITION); + a_Pkt.WriteBool(EnderCrystal.DisplaysBeam()); + if (EnderCrystal.DisplaysBeam()) + { + a_Pkt.WriteXYZPosition64(EnderCrystal.GetBeamTarget()); + } + a_Pkt.WriteBEUInt8(8); + a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL); + a_Pkt.WriteBool(EnderCrystal.ShowsBottom()); + break; + } // case etEnderCrystal + default: { break; diff --git a/src/Protocol/Protocol_1_12.cpp b/src/Protocol/Protocol_1_12.cpp index 16651bdf6..ee2016ae2 100644 --- a/src/Protocol/Protocol_1_12.cpp +++ b/src/Protocol/Protocol_1_12.cpp @@ -13,6 +13,7 @@ Implements the 1.12 protocol classes: #include "Packetizer.h" #include "../Entities/Boat.h" +#include "../Entities/EnderCrystal.h" #include "../Entities/Minecart.h" #include "../Entities/Pickup.h" #include "../Entities/Player.h" @@ -518,6 +519,22 @@ void cProtocol_1_12::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_ break; } // case etItemFrame + case cEntity::etEnderCrystal: + { + const auto & EnderCrystal = static_cast<const cEnderCrystal &>(a_Entity); + a_Pkt.WriteBEUInt8(7); + a_Pkt.WriteBEUInt8(METADATA_TYPE_OPTIONAL_POSITION); + a_Pkt.WriteBool(EnderCrystal.DisplaysBeam()); + if (EnderCrystal.DisplaysBeam()) + { + a_Pkt.WriteXYZPosition64(EnderCrystal.GetBeamTarget()); + } + a_Pkt.WriteBEUInt8(8); + a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL); + a_Pkt.WriteBool(EnderCrystal.ShowsBottom()); + break; + } // case etEnderCrystal + default: { break; diff --git a/src/Protocol/Protocol_1_13.cpp b/src/Protocol/Protocol_1_13.cpp index 1b505d58d..efc1e9fc1 100644 --- a/src/Protocol/Protocol_1_13.cpp +++ b/src/Protocol/Protocol_1_13.cpp @@ -12,6 +12,7 @@ Implements the 1.13 protocol classes: #include "Protocol_1_13.h" #include "../Entities/Boat.h" +#include "../Entities/EnderCrystal.h" #include "../Entities/Minecart.h" #include "../Entities/Pickup.h" #include "../Entities/Player.h" @@ -887,6 +888,20 @@ void cProtocol_1_13::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a_ break; } // case etItemFrame + case cEntity::etEnderCrystal: + { + const auto & EnderCrystal = static_cast<const cEnderCrystal &>(a_Entity); + WriteEntityMetadata(a_Pkt, EntityMetadata::EnderCrystalBeamTarget, EntityMetadataType::OptPosition); + a_Pkt.WriteBool(EnderCrystal.DisplaysBeam()); + if (EnderCrystal.DisplaysBeam()) + { + a_Pkt.WriteXYZPosition64(EnderCrystal.GetBeamTarget()); + } + WriteEntityMetadata(a_Pkt, EntityMetadata::EnderCrystalShowBottom, EntityMetadataType::Boolean); + a_Pkt.WriteBool(EnderCrystal.ShowsBottom()); + break; + } // case etEnderCrystal + default: { break; diff --git a/src/Protocol/Protocol_1_9.cpp b/src/Protocol/Protocol_1_9.cpp index a152a46cb..778d4ca30 100644 --- a/src/Protocol/Protocol_1_9.cpp +++ b/src/Protocol/Protocol_1_9.cpp @@ -28,6 +28,7 @@ Implements the 1.9 protocol classes: #include "../WorldStorage/FastNBT.h" +#include "../Entities/EnderCrystal.h" #include "../Entities/ExpOrb.h" #include "../Entities/Minecart.h" #include "../Entities/FallingBlock.h" @@ -1727,6 +1728,21 @@ void cProtocol_1_9_0::WriteEntityMetadata(cPacketizer & a_Pkt, const cEntity & a break; } // case etItemFrame + case cEntity::etEnderCrystal: + { + const auto & EnderCrystal = static_cast<const cEnderCrystal &>(a_Entity); + a_Pkt.WriteBEUInt8(7); + a_Pkt.WriteBEUInt8(METADATA_TYPE_OPTIONAL_POSITION); + a_Pkt.WriteBool(EnderCrystal.DisplaysBeam()); + if (EnderCrystal.DisplaysBeam()) + { + a_Pkt.WriteXYZPosition64(EnderCrystal.GetBeamTarget()); + } + a_Pkt.WriteBEUInt8(8); + a_Pkt.WriteBEUInt8(METADATA_TYPE_BOOL); + a_Pkt.WriteBool(EnderCrystal.ShowsBottom()); + break; + } // case etEnderCrystal default: { break; |