diff options
author | x12xx12x <44411062+12xx12@users.noreply.github.com> | 2022-04-19 20:30:12 +0200 |
---|---|---|
committer | Alexander Harkness <me@bearbin.net> | 2022-04-20 09:41:02 +0200 |
commit | 5ea7675eca4fe50feed7fc4b871075f8c937d8b1 (patch) | |
tree | 440c01c9c6b783b27155c631273c60d32092c38f /src/Protocol/Protocol_1_9.cpp | |
parent | Check height is within world for pistons and digging (#5396) (diff) | |
download | cuberite-5ea7675eca4fe50feed7fc4b871075f8c937d8b1.tar cuberite-5ea7675eca4fe50feed7fc4b871075f8c937d8b1.tar.gz cuberite-5ea7675eca4fe50feed7fc4b871075f8c937d8b1.tar.bz2 cuberite-5ea7675eca4fe50feed7fc4b871075f8c937d8b1.tar.lz cuberite-5ea7675eca4fe50feed7fc4b871075f8c937d8b1.tar.xz cuberite-5ea7675eca4fe50feed7fc4b871075f8c937d8b1.tar.zst cuberite-5ea7675eca4fe50feed7fc4b871075f8c937d8b1.zip |
Diffstat (limited to 'src/Protocol/Protocol_1_9.cpp')
-rw-r--r-- | src/Protocol/Protocol_1_9.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/Protocol/Protocol_1_9.cpp b/src/Protocol/Protocol_1_9.cpp index ad304b4ac..5e630f457 100644 --- a/src/Protocol/Protocol_1_9.cpp +++ b/src/Protocol/Protocol_1_9.cpp @@ -557,16 +557,16 @@ void cProtocol_1_9_0::SendPlayerSpawn(const cPlayer & a_Player) -void cProtocol_1_9_0::SendSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) +void cProtocol_1_9_0::SendSoundEffect(const AString & a_SoundName, Vector3d a_Origin, float a_Volume, float a_Pitch) { ASSERT(m_State == 3); // In game mode? cPacketizer Pkt(*this, pktSoundEffect); Pkt.WriteString(a_SoundName); Pkt.WriteVarInt32(0); // Master sound category (may want to be changed to a parameter later) - Pkt.WriteBEInt32(static_cast<Int32>(a_X * 8.0)); - Pkt.WriteBEInt32(static_cast<Int32>(a_Y * 8.0)); - Pkt.WriteBEInt32(static_cast<Int32>(a_Z * 8.0)); + Pkt.WriteBEInt32(static_cast<Int32>(a_Origin.x * 8.0)); + Pkt.WriteBEInt32(static_cast<Int32>(a_Origin.y * 8.0)); + Pkt.WriteBEInt32(static_cast<Int32>(a_Origin.z * 8.0)); Pkt.WriteBEFloat(a_Volume); Pkt.WriteBEUInt8(static_cast<Byte>(a_Pitch * 63)); } @@ -611,16 +611,16 @@ void cProtocol_1_9_0::SendSpawnMob(const cMonster & a_Mob) -void cProtocol_1_9_0::SendThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ) +void cProtocol_1_9_0::SendThunderbolt(Vector3i a_Origin) { ASSERT(m_State == 3); // In game mode? cPacketizer Pkt(*this, pktSpawnGlobalEntity); Pkt.WriteVarInt32(0); // EntityID = 0, always Pkt.WriteBEUInt8(1); // Type = Thunderbolt - Pkt.WriteBEDouble(a_BlockX); - Pkt.WriteBEDouble(a_BlockY); - Pkt.WriteBEDouble(a_BlockZ); + Pkt.WriteBEDouble(a_Origin.x); + Pkt.WriteBEDouble(a_Origin.y); + Pkt.WriteBEDouble(a_Origin.z); } @@ -873,14 +873,14 @@ void cProtocol_1_9_0::HandlePacketBlockDig(cByteBuffer & a_ByteBuffer) { HANDLE_READ(a_ByteBuffer, ReadBEUInt8, UInt8, Status); - int BlockX, BlockY, BlockZ; - if (!a_ByteBuffer.ReadXYZPosition64(BlockX, BlockY, BlockZ)) + Vector3i Position; + if (!a_ByteBuffer.ReadXYZPosition64(Position)) { return; } HANDLE_READ(a_ByteBuffer, ReadVarInt, Int32, Face); - m_Client->HandleLeftClick(BlockX, BlockY, BlockZ, FaceIntToBlockFace(Face), Status); + m_Client->HandleLeftClick(Position, FaceIntToBlockFace(Face), Status); } @@ -889,8 +889,8 @@ void cProtocol_1_9_0::HandlePacketBlockDig(cByteBuffer & a_ByteBuffer) void cProtocol_1_9_0::HandlePacketBlockPlace(cByteBuffer & a_ByteBuffer) { - int BlockX, BlockY, BlockZ; - if (!a_ByteBuffer.ReadXYZPosition64(BlockX, BlockY, BlockZ)) + Vector3i Position; + if (!a_ByteBuffer.ReadXYZPosition64(Position)) { return; } @@ -901,7 +901,7 @@ void cProtocol_1_9_0::HandlePacketBlockPlace(cByteBuffer & a_ByteBuffer) HANDLE_READ(a_ByteBuffer, ReadBEUInt8, UInt8, CursorY); HANDLE_READ(a_ByteBuffer, ReadBEUInt8, UInt8, CursorZ); - m_Client->HandleRightClick(BlockX, BlockY, BlockZ, FaceIntToBlockFace(Face), CursorX, CursorY, CursorZ, Hand == MAIN_HAND); + m_Client->HandleRightClick(Position, FaceIntToBlockFace(Face), CursorX, CursorY, CursorZ, Hand == MAIN_HAND); } @@ -1074,8 +1074,8 @@ void cProtocol_1_9_0::HandlePacketTabComplete(cByteBuffer & a_ByteBuffer) void cProtocol_1_9_0::HandlePacketUpdateSign(cByteBuffer & a_ByteBuffer) { - int BlockX, BlockY, BlockZ; - if (!a_ByteBuffer.ReadXYZPosition64(BlockX, BlockY, BlockZ)) + Vector3i Position; + if (!a_ByteBuffer.ReadXYZPosition64(Position)) { return; } @@ -1087,7 +1087,7 @@ void cProtocol_1_9_0::HandlePacketUpdateSign(cByteBuffer & a_ByteBuffer) Lines[i] = Line; } - m_Client->HandleUpdateSign(BlockX, BlockY, BlockZ, Lines[0], Lines[1], Lines[2], Lines[3]); + m_Client->HandleUpdateSign(Position, Lines[0], Lines[1], Lines[2], Lines[3]); } @@ -1246,7 +1246,7 @@ void cProtocol_1_9_0::HandleVanillaPluginMessage(cByteBuffer & a_ByteBuffer, std HANDLE_READ(a_ByteBuffer, ReadBool, bool, Conditional); HANDLE_READ(a_ByteBuffer, ReadBool, bool, Automatic); - m_Client->HandleCommandBlockBlockChange(BlockX, BlockY, BlockZ, Command); + m_Client->HandleCommandBlockBlockChange({BlockX, BlockY, BlockZ}, Command); } else if (a_Channel == "PickItem") { @@ -2401,19 +2401,19 @@ cProtocol::Version cProtocol_1_9_2::GetProtocolVersion() const //////////////////////////////////////////////////////////////////////////////// // cProtocol_1_9_4: -void cProtocol_1_9_4::SendUpdateSign(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) +void cProtocol_1_9_4::SendUpdateSign(Vector3i a_BlockPos, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) { ASSERT(m_State == 3); // In game mode? // 1.9.4 removed the update sign packet and now uses Update Block Entity cPacketizer Pkt(*this, pktUpdateBlockEntity); - Pkt.WriteXYZPosition64(a_BlockX, a_BlockY, a_BlockZ); + Pkt.WriteXYZPosition64(a_BlockPos); Pkt.WriteBEUInt8(9); // Action 9 - update sign cFastNBTWriter Writer; - Writer.AddInt("x", a_BlockX); - Writer.AddInt("y", a_BlockY); - Writer.AddInt("z", a_BlockZ); + Writer.AddInt("x", a_BlockPos.x); + Writer.AddInt("y", a_BlockPos.y); + Writer.AddInt("z", a_BlockPos.z); Writer.AddString("id", "Sign"); Json::Value Line1; |