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_8.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_8.cpp')
-rw-r--r-- | src/Protocol/Protocol_1_8.cpp | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/src/Protocol/Protocol_1_8.cpp b/src/Protocol/Protocol_1_8.cpp index a84dadf53..41217ec9c 100644 --- a/src/Protocol/Protocol_1_8.cpp +++ b/src/Protocol/Protocol_1_8.cpp @@ -212,12 +212,12 @@ void cProtocol_1_8_0::SendAttachEntity(const cEntity & a_Entity, const cEntity & -void cProtocol_1_8_0::SendBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) +void cProtocol_1_8_0::SendBlockAction(Vector3i a_BlockPos, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) { ASSERT(m_State == 3); // In game mode? cPacketizer Pkt(*this, pktBlockAction); - Pkt.WriteXYZPosition64(a_BlockX, a_BlockY, a_BlockZ); + Pkt.WriteXYZPosition64(a_BlockPos); Pkt.WriteBEInt8(a_Byte1); Pkt.WriteBEInt8(a_Byte2); Pkt.WriteVarInt32(a_BlockType); @@ -227,13 +227,13 @@ void cProtocol_1_8_0::SendBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, -void cProtocol_1_8_0::SendBlockBreakAnim(UInt32 a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) +void cProtocol_1_8_0::SendBlockBreakAnim(UInt32 a_EntityID, Vector3i a_BlockPos, char a_Stage) { ASSERT(m_State == 3); // In game mode? cPacketizer Pkt(*this, pktBlockBreakAnim); Pkt.WriteVarInt32(a_EntityID); - Pkt.WriteXYZPosition64(a_BlockX, a_BlockY, a_BlockZ); + Pkt.WriteXYZPosition64(a_BlockPos); Pkt.WriteBEInt8(a_Stage); } @@ -241,12 +241,12 @@ void cProtocol_1_8_0::SendBlockBreakAnim(UInt32 a_EntityID, int a_BlockX, int a_ -void cProtocol_1_8_0::SendBlockChange(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) +void cProtocol_1_8_0::SendBlockChange(Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) { ASSERT(m_State == 3); // In game mode? cPacketizer Pkt(*this, pktBlockChange); - Pkt.WriteXYZPosition64(a_BlockX, a_BlockY, a_BlockZ); + Pkt.WriteXYZPosition64(a_BlockPos); Pkt.WriteVarInt32((static_cast<UInt32>(a_BlockType) << 4) | (static_cast<UInt32>(a_BlockMeta) & 15)); } @@ -486,12 +486,12 @@ void cProtocol_1_8_0::SendDisconnect(const AString & a_Reason) -void cProtocol_1_8_0::SendEditSign(int a_BlockX, int a_BlockY, int a_BlockZ) +void cProtocol_1_8_0::SendEditSign(Vector3i a_BlockPos) { ASSERT(m_State == 3); // In game mode? cPacketizer Pkt(*this, pktEditSign); - Pkt.WriteXYZPosition64(a_BlockX, a_BlockY, a_BlockZ); + Pkt.WriteXYZPosition64(a_BlockPos); } @@ -979,19 +979,19 @@ void cProtocol_1_8_0::SendPlayerAbilities(void) -void cProtocol_1_8_0::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) +void cProtocol_1_8_0::SendParticleEffect(const AString & a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount) { ASSERT(m_State == 3); // In game mode? cPacketizer Pkt(*this, pktParticleEffect); Pkt.WriteBEInt32(GetProtocolParticleID(a_ParticleName)); Pkt.WriteBool(false); - Pkt.WriteBEFloat(a_SrcX); - Pkt.WriteBEFloat(a_SrcY); - Pkt.WriteBEFloat(a_SrcZ); - Pkt.WriteBEFloat(a_OffsetX); - Pkt.WriteBEFloat(a_OffsetY); - Pkt.WriteBEFloat(a_OffsetZ); + Pkt.WriteBEFloat(a_Src.x); + Pkt.WriteBEFloat(a_Src.y); + Pkt.WriteBEFloat(a_Src.z); + Pkt.WriteBEFloat(a_Offset.x); + Pkt.WriteBEFloat(a_Offset.y); + Pkt.WriteBEFloat(a_Offset.z); Pkt.WriteBEFloat(a_ParticleData); Pkt.WriteBEInt32(a_ParticleAmount); } @@ -1389,15 +1389,15 @@ void cProtocol_1_8_0::SendSetRawTitle(const AString & a_Title) -void cProtocol_1_8_0::SendSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) +void cProtocol_1_8_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.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)); } @@ -1406,13 +1406,13 @@ void cProtocol_1_8_0::SendSoundEffect(const AString & a_SoundName, double a_X, d -void cProtocol_1_8_0::SendSoundParticleEffect(const EffectID a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) +void cProtocol_1_8_0::SendSoundParticleEffect(const EffectID a_EffectID, Vector3i a_Origin, int a_Data) { ASSERT(m_State == 3); // In game mode? cPacketizer Pkt(*this, pktSoundParticleEffect); Pkt.WriteBEInt32(static_cast<int>(a_EffectID)); - Pkt.WriteXYZPosition64(a_SrcX, a_SrcY, a_SrcZ); + Pkt.WriteXYZPosition64(a_Origin); Pkt.WriteBEInt32(a_Data); Pkt.WriteBool(false); } @@ -1536,16 +1536,16 @@ void cProtocol_1_8_0::SendTabCompletionResults(const AStringVector & a_Results) -void cProtocol_1_8_0::SendThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ) +void cProtocol_1_8_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.WriteFPInt(a_BlockX); - Pkt.WriteFPInt(a_BlockY); - Pkt.WriteFPInt(a_BlockZ); + Pkt.WriteFPInt(a_Origin.x); + Pkt.WriteFPInt(a_Origin.y); + Pkt.WriteFPInt(a_Origin.z); } @@ -1649,12 +1649,12 @@ void cProtocol_1_8_0::SendUpdateBlockEntity(cBlockEntity & a_BlockEntity) -void cProtocol_1_8_0::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_8_0::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? cPacketizer Pkt(*this, pktUpdateSign); - Pkt.WriteXYZPosition64(a_BlockX, a_BlockY, a_BlockZ); + Pkt.WriteXYZPosition64(a_BlockPos); AString Lines[] = { a_Line1, a_Line2, a_Line3, a_Line4 }; for (size_t i = 0; i < ARRAYCOUNT(Lines); i++) @@ -2342,15 +2342,15 @@ void cProtocol_1_8_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, ReadBEInt8, Int8, Face); - m_Client->HandleLeftClick(BlockX, BlockY, BlockZ, FaceIntToBlockFace(Face), Status); + m_Client->HandleLeftClick(Position, FaceIntToBlockFace(Face), Status); } @@ -2359,8 +2359,8 @@ void cProtocol_1_8_0::HandlePacketBlockDig(cByteBuffer & a_ByteBuffer) void cProtocol_1_8_0::HandlePacketBlockPlace(cByteBuffer & a_ByteBuffer) { - int BlockX, BlockY, BlockZ; - if (!a_ByteBuffer.ReadXYZPosition64(BlockX, BlockY, BlockZ)) + Vector3i BlockPos; + if (!a_ByteBuffer.ReadXYZPosition64(BlockPos)) { return; } @@ -2381,7 +2381,7 @@ void cProtocol_1_8_0::HandlePacketBlockPlace(cByteBuffer & a_ByteBuffer) } else { - m_Client->HandleRightClick(BlockX, BlockY, BlockZ, blockFace, CursorX, CursorY, CursorZ, true); + m_Client->HandleRightClick(BlockPos, blockFace, CursorX, CursorY, CursorZ, true); } } @@ -2681,8 +2681,8 @@ void cProtocol_1_8_0::HandlePacketTabComplete(cByteBuffer & a_ByteBuffer) void cProtocol_1_8_0::HandlePacketUpdateSign(cByteBuffer & a_ByteBuffer) { - int BlockX, BlockY, BlockZ; - if (!a_ByteBuffer.ReadXYZPosition64(BlockX, BlockY, BlockZ)) + Vector3i Position; + if (!a_ByteBuffer.ReadXYZPosition64(Position)) { return; } @@ -2699,7 +2699,7 @@ void cProtocol_1_8_0::HandlePacketUpdateSign(cByteBuffer & a_ByteBuffer) } } - 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]); } @@ -2843,7 +2843,7 @@ void cProtocol_1_8_0::HandleVanillaPluginMessage(cByteBuffer & a_ByteBuffer, con HANDLE_READ(a_ByteBuffer, ReadBool, bool, TrackOutput); // Editing a command-block: - m_Client->HandleCommandBlockBlockChange(BlockX, BlockY, BlockZ, Command); + m_Client->HandleCommandBlockBlockChange({BlockX, BlockY, BlockZ}, Command); return; } case 0x01: |