summaryrefslogtreecommitdiffstats
path: root/src/Protocol
diff options
context:
space:
mode:
authorx12xx12x <44411062+12xx12@users.noreply.github.com>2022-04-19 20:30:12 +0200
committerAlexander Harkness <me@bearbin.net>2022-04-20 09:41:02 +0200
commit5ea7675eca4fe50feed7fc4b871075f8c937d8b1 (patch)
tree440c01c9c6b783b27155c631273c60d32092c38f /src/Protocol
parentCheck height is within world for pistons and digging (#5396) (diff)
downloadcuberite-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')
-rw-r--r--src/Protocol/Protocol.h18
-rw-r--r--src/Protocol/Protocol_1_10.cpp8
-rw-r--r--src/Protocol/Protocol_1_10.h2
-rw-r--r--src/Protocol/Protocol_1_11.cpp8
-rw-r--r--src/Protocol/Protocol_1_13.cpp4
-rw-r--r--src/Protocol/Protocol_1_13.h2
-rw-r--r--src/Protocol/Protocol_1_14.cpp10
-rw-r--r--src/Protocol/Protocol_1_14.h10
-rw-r--r--src/Protocol/Protocol_1_8.cpp74
-rw-r--r--src/Protocol/Protocol_1_8.h18
-rw-r--r--src/Protocol/Protocol_1_9.cpp46
-rw-r--r--src/Protocol/Protocol_1_9.h6
12 files changed, 103 insertions, 103 deletions
diff --git a/src/Protocol/Protocol.h b/src/Protocol/Protocol.h
index 4acc0546a..df6bd2bee 100644
--- a/src/Protocol/Protocol.h
+++ b/src/Protocol/Protocol.h
@@ -357,9 +357,9 @@ public:
// Sending stuff to clients (alphabetically sorted):
virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity & a_Vehicle) = 0;
- virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) = 0;
- virtual void SendBlockBreakAnim (UInt32 a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) = 0;
- virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) = 0;
+ virtual void SendBlockAction (Vector3i a_BlockPos, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) = 0;
+ virtual void SendBlockBreakAnim (UInt32 a_EntityID, Vector3i a_BlockPos, char a_Stage) = 0;
+ virtual void SendBlockChange (Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) = 0;
virtual void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) = 0;
virtual void SendBossBarAdd (UInt32 a_UniqueID, const cCompositeChat & a_Title, float a_FractionFilled, BossBarColor a_Color, BossBarDivisionType a_DivisionType, bool a_DarkenSky, bool a_PlayEndMusic, bool a_CreateFog) = 0;
virtual void SendBossBarRemove (UInt32 a_UniqueID) = 0;
@@ -376,7 +376,7 @@ public:
virtual void SendDestroyEntity (const cEntity & a_Entity) = 0;
virtual void SendDetachEntity (const cEntity & a_Entity, const cEntity & a_PreviousVehicle) = 0;
virtual void SendDisconnect (const AString & a_Reason) = 0;
- virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) = 0; ///< Request the client to open up the sign editor for the sign (1.6+)
+ virtual void SendEditSign (Vector3i a_BlockPos) = 0; ///< Request the client to open up the sign editor for the sign (1.6+)
virtual void SendEntityEffect (const cEntity & a_Entity, int a_EffectID, int a_Amplifier, int a_Duration) = 0;
virtual void SendEntityAnimation (const cEntity & a_Entity, EntityAnimation a_Animation) = 0;
virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) = 0;
@@ -399,7 +399,7 @@ public:
virtual void SendMapData (const cMap & a_Map, int a_DataStartX, int a_DataStartY) = 0;
virtual void SendPaintingSpawn (const cPainting & a_Painting) = 0;
virtual void SendPlayerAbilities (void) = 0;
- virtual void SendParticleEffect (const AString & a_SoundName, float a_SrcX, float a_SrcY, float a_SrcZ, float a_OffsetX, float a_OffsetY, float a_OffsetZ, float a_ParticleData, int a_ParticleAmount) = 0;
+ virtual void SendParticleEffect (const AString & a_SoundName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount) = 0;
virtual void SendParticleEffect (const AString & a_SoundName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, std::array<int, 2> a_Data) = 0;
virtual void SendPlayerListAddPlayer (const cPlayer & a_Player) = 0;
virtual void SendPlayerListHeaderFooter (const cCompositeChat & a_Header, const cCompositeChat & a_Footer) = 0;
@@ -425,19 +425,19 @@ public:
virtual void SendSetRawSubTitle (const AString & a_SubTitle) = 0;
virtual void SendSetTitle (const cCompositeChat & a_Title) = 0;
virtual void SendSetRawTitle (const AString & a_Title) = 0;
- virtual void SendSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) = 0;
- virtual void SendSoundParticleEffect (const EffectID a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) = 0;
+ virtual void SendSoundEffect (const AString & a_SoundName, Vector3d a_Origin, float a_Volume, float a_Pitch) = 0;
+ virtual void SendSoundParticleEffect (const EffectID a_EffectID, Vector3i a_Origin, int a_Data) = 0;
virtual void SendSpawnEntity (const cEntity & a_Entity) = 0;
virtual void SendSpawnMob (const cMonster & a_Mob) = 0;
virtual void SendStatistics (const StatisticsManager & a_Manager) = 0;
virtual void SendTabCompletionResults (const AStringVector & a_Results) = 0;
- virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) = 0;
+ virtual void SendThunderbolt (Vector3i a_Origin) = 0;
virtual void SendTitleTimes (int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks) = 0;
virtual void SendTimeUpdate (cTickTimeLong a_WorldAge, cTickTimeLong a_WorldDate, bool a_DoDaylightCycle) = 0;
virtual void SendUnleashEntity (const cEntity & a_Entity) = 0;
virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) = 0;
virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) = 0;
- virtual void 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) = 0;
+ virtual void SendUpdateSign (Vector3i a_BlockPos, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) = 0;
virtual void SendUnlockRecipe (UInt32 a_RecipeID) = 0;
virtual void SendInitRecipes (UInt32 a_RecipeID) = 0;
virtual void SendWeather (eWeather a_Weather) = 0;
diff --git a/src/Protocol/Protocol_1_10.cpp b/src/Protocol/Protocol_1_10.cpp
index 4f3e1a52b..beca6db24 100644
--- a/src/Protocol/Protocol_1_10.cpp
+++ b/src/Protocol/Protocol_1_10.cpp
@@ -311,16 +311,16 @@ namespace Metadata
////////////////////////////////////////////////////////////////////////////////
// cProtocol_1_10_0:
-void cProtocol_1_10_0::SendSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch)
+void cProtocol_1_10_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(FloorC(a_X * 8.0));
- Pkt.WriteBEInt32(FloorC(a_Y * 8.0));
- Pkt.WriteBEInt32(FloorC(a_Z * 8.0));
+ Pkt.WriteBEInt32(FloorC(a_Origin.x * 8.0));
+ Pkt.WriteBEInt32(FloorC(a_Origin.y * 8.0));
+ Pkt.WriteBEInt32(FloorC(a_Origin.z * 8.0));
Pkt.WriteBEFloat(a_Volume);
Pkt.WriteBEFloat(a_Pitch);
}
diff --git a/src/Protocol/Protocol_1_10.h b/src/Protocol/Protocol_1_10.h
index f4ede2949..48bc4d7f6 100644
--- a/src/Protocol/Protocol_1_10.h
+++ b/src/Protocol/Protocol_1_10.h
@@ -30,7 +30,7 @@ public:
protected:
- virtual void SendSoundEffect(const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) override;
+ virtual void SendSoundEffect(const AString & a_SoundName, Vector3d a_Origin, float a_Volume, float a_Pitch) override;
virtual UInt32 GetProtocolMobType(eMonsterType a_MobType) const override;
virtual Version GetProtocolVersion() const override;
diff --git a/src/Protocol/Protocol_1_11.cpp b/src/Protocol/Protocol_1_11.cpp
index 2ccc4483a..cde4b38e3 100644
--- a/src/Protocol/Protocol_1_11.cpp
+++ b/src/Protocol/Protocol_1_11.cpp
@@ -368,7 +368,7 @@ void cProtocol_1_11_0::SendEntityAnimation(const cEntity & a_Entity, const Entit
const auto Position = a_Entity.GetPosition();
// 1.11 dropped the automatic particle effect + sound on item break. Emulate at least some of it:
- SendSoundEffect("entity.item.break", Position.x, Position.y, Position.z, 1, 0.75f + ((a_Entity.GetUniqueID() * 23) % 32) / 64.f);
+ SendSoundEffect("entity.item.break", Position, 1, 0.75f + ((a_Entity.GetUniqueID() * 23) % 32) / 64.f);
break;
}
default: break;
@@ -588,8 +588,8 @@ cProtocol::Version cProtocol_1_11_0::GetProtocolVersion() const
void cProtocol_1_11_0::HandlePacketBlockPlace(cByteBuffer & a_ByteBuffer)
{
- int BlockX, BlockY, BlockZ;
- if (!a_ByteBuffer.ReadXYZPosition64(BlockX, BlockY, BlockZ))
+ Vector3i Position;
+ if (!a_ByteBuffer.ReadXYZPosition64(Position))
{
return;
}
@@ -600,7 +600,7 @@ void cProtocol_1_11_0::HandlePacketBlockPlace(cByteBuffer & a_ByteBuffer)
HANDLE_READ(a_ByteBuffer, ReadBEFloat, float, CursorY);
HANDLE_READ(a_ByteBuffer, ReadBEFloat, float, CursorZ);
- m_Client->HandleRightClick(BlockX, BlockY, BlockZ, FaceIntToBlockFace(Face), FloorC(CursorX * 16), FloorC(CursorY * 16), FloorC(CursorZ * 16), Hand == 0);
+ m_Client->HandleRightClick(Position, FaceIntToBlockFace(Face), FloorC(CursorX * 16), FloorC(CursorY * 16), FloorC(CursorZ * 16), Hand == 0);
}
diff --git a/src/Protocol/Protocol_1_13.cpp b/src/Protocol/Protocol_1_13.cpp
index bee1a49bb..d6d25dc3e 100644
--- a/src/Protocol/Protocol_1_13.cpp
+++ b/src/Protocol/Protocol_1_13.cpp
@@ -74,10 +74,10 @@ Implements the 1.13 protocol classes:
////////////////////////////////////////////////////////////////////////////////
// cProtocol_1_13:
-void cProtocol_1_13::SendBlockChange(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
+void cProtocol_1_13::SendBlockChange(Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
{
cPacketizer Pkt(*this, pktBlockChange);
- Pkt.WriteXYZPosition64(a_BlockX, a_BlockY, a_BlockZ);
+ Pkt.WriteXYZPosition64(a_BlockPos);
Pkt.WriteVarInt32(GetProtocolBlockType(a_BlockType, a_BlockMeta));
}
diff --git a/src/Protocol/Protocol_1_13.h b/src/Protocol/Protocol_1_13.h
index 88d21c1db..63f1281b6 100644
--- a/src/Protocol/Protocol_1_13.h
+++ b/src/Protocol/Protocol_1_13.h
@@ -36,7 +36,7 @@ public:
protected:
- virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
+ virtual void SendBlockChange (Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
virtual void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) override;
virtual void SendMapData (const cMap & a_Map, int a_DataStartX, int a_DataStartY) override;
virtual void SendPaintingSpawn (const cPainting & a_Painting) override;
diff --git a/src/Protocol/Protocol_1_14.cpp b/src/Protocol/Protocol_1_14.cpp
index f38227edd..2c6451e56 100644
--- a/src/Protocol/Protocol_1_14.cpp
+++ b/src/Protocol/Protocol_1_14.cpp
@@ -24,7 +24,7 @@ Implements the 1.14 protocol classes:
////////////////////////////////////////////////////////////////////////////////
// cProtocol_1_14:
-void cProtocol_1_14::SendBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType)
+void cProtocol_1_14::SendBlockAction(Vector3i a_BlockPos, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType)
{
}
@@ -32,7 +32,7 @@ void cProtocol_1_14::SendBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, c
-void cProtocol_1_14::SendBlockBreakAnim(UInt32 a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage)
+void cProtocol_1_14::SendBlockBreakAnim(UInt32 a_EntityID, Vector3i a_BlockPos, char a_Stage)
{
}
@@ -40,7 +40,7 @@ void cProtocol_1_14::SendBlockBreakAnim(UInt32 a_EntityID, int a_BlockX, int a_B
-void cProtocol_1_14::SendEditSign(int a_BlockX, int a_BlockY, int a_BlockZ)
+void cProtocol_1_14::SendEditSign(Vector3i a_BlockPos)
{
}
@@ -104,7 +104,7 @@ void cProtocol_1_14::SendPaintingSpawn(const cPainting & a_Painting)
-void cProtocol_1_14::SendSoundParticleEffect(const EffectID a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data)
+void cProtocol_1_14::SendSoundParticleEffect(const EffectID a_EffectID, Vector3i a_Origin, int a_Data)
{
}
@@ -120,7 +120,7 @@ void cProtocol_1_14::SendUpdateBlockEntity(cBlockEntity & a_BlockEntity)
-void cProtocol_1_14::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_14::SendUpdateSign(Vector3i a_BlockPos, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4)
{
}
diff --git a/src/Protocol/Protocol_1_14.h b/src/Protocol/Protocol_1_14.h
index f4907a7d0..2effea504 100644
--- a/src/Protocol/Protocol_1_14.h
+++ b/src/Protocol/Protocol_1_14.h
@@ -30,15 +30,15 @@ public:
protected:
- virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) override;
- virtual void SendBlockBreakAnim (UInt32 a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) override;
- virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) override; ///< Request the client to open up the sign editor for the sign (1.6+)
+ virtual void SendBlockAction (Vector3i a_BlockPos, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) override;
+ virtual void SendBlockBreakAnim (UInt32 a_EntityID, Vector3i a_BlockPos, char a_Stage) override;
+ virtual void SendEditSign (Vector3i a_BlockPos) override; ///< Request the client to open up the sign editor for the sign (1.6+)
virtual void SendEntityAnimation (const cEntity & a_Entity, EntityAnimation a_Animation) override;
virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override;
virtual void SendPaintingSpawn (const cPainting & a_Painting) override;
- virtual void SendSoundParticleEffect (const EffectID a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override;
+ virtual void SendSoundParticleEffect (const EffectID a_EffectID, Vector3i a_Origin, int a_Data) override;
virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) override;
- virtual void 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) override;
+ virtual void SendUpdateSign (Vector3i a_BlockPos, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) override;
virtual UInt32 GetPacketID(ePacketType a_PacketType) const override;
virtual std::pair<short, short> GetItemFromProtocolID(UInt32 a_ProtocolID) const override;
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:
diff --git a/src/Protocol/Protocol_1_8.h b/src/Protocol/Protocol_1_8.h
index 6ee1fdcaf..f32754d87 100644
--- a/src/Protocol/Protocol_1_8.h
+++ b/src/Protocol/Protocol_1_8.h
@@ -41,9 +41,9 @@ public:
// Sending stuff to clients (alphabetically sorted):
virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity & a_Vehicle) override;
- virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) override;
- virtual void SendBlockBreakAnim (UInt32 a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) override;
- virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
+ virtual void SendBlockAction (Vector3i a_BlockPos, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) override;
+ virtual void SendBlockBreakAnim (UInt32 a_EntityID, Vector3i a_BlockPos, char a_Stage) override;
+ virtual void SendBlockChange (Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override;
virtual void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) override;
virtual void SendBossBarAdd (UInt32 a_UniqueID, const cCompositeChat & a_Title, float a_FractionFilled, BossBarColor a_Color, BossBarDivisionType a_DivisionType, bool a_DarkenSky, bool a_PlayEndMusic, bool a_CreateFog) override;
virtual void SendBossBarRemove (UInt32 a_UniqueID) override;
@@ -60,7 +60,7 @@ public:
virtual void SendDestroyEntity (const cEntity & a_Entity) override;
virtual void SendDetachEntity (const cEntity & a_Entity, const cEntity & a_PreviousVehicle) override;
virtual void SendDisconnect (const AString & a_Reason) override;
- virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) override; ///< Request the client to open up the sign editor for the sign (1.6+)
+ virtual void SendEditSign (Vector3i a_BlockPos) override; ///< Request the client to open up the sign editor for the sign (1.6+)
virtual void SendEntityAnimation (const cEntity & a_Entity, EntityAnimation a_Animation) override;
virtual void SendEntityEffect (const cEntity & a_Entity, int a_EffectID, int a_Amplifier, int a_Duration) override;
virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override;
@@ -85,7 +85,7 @@ public:
virtual void SendMapData (const cMap & a_Map, int a_DataStartX, int a_DataStartY) override;
virtual void SendPaintingSpawn (const cPainting & a_Painting) override;
virtual void SendPlayerAbilities (void) override;
- virtual void 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) override;
+ virtual void SendParticleEffect (const AString & a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount) override;
virtual void SendParticleEffect (const AString & a_ParticleName, Vector3f a_Src, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, std::array<int, 2> a_Data) override;
virtual void SendPlayerListAddPlayer (const cPlayer & a_Player) override;
virtual void SendPlayerListHeaderFooter (const cCompositeChat & a_Header, const cCompositeChat & a_Footer) override;
@@ -102,7 +102,7 @@ public:
virtual void SendResetTitle (void) override;
virtual void SendResourcePack (const AString & a_ResourcePackUrl) override;
virtual void SendRespawn (eDimension a_Dimension) override;
- virtual void SendSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) override;
+ virtual void SendSoundEffect (const AString & a_SoundName, Vector3d a_Origin, float a_Volume, float a_Pitch) override;
virtual void SendScoreboardObjective (const AString & a_Name, const AString & a_DisplayName, Byte a_Mode) override;
virtual void SendScoreUpdate (const AString & a_Objective, const AString & a_Player, cObjective::Score a_Score, Byte a_Mode) override;
virtual void SendDisplayObjective (const AString & a_Objective, cScoreboard::eDisplaySlot a_Display) override;
@@ -110,18 +110,18 @@ public:
virtual void SendSetRawSubTitle (const AString & a_SubTitle) override;
virtual void SendSetTitle (const cCompositeChat & a_Title) override;
virtual void SendSetRawTitle (const AString & a_Title) override;
- virtual void SendSoundParticleEffect (const EffectID a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override;
+ virtual void SendSoundParticleEffect (const EffectID a_EffectID, Vector3i a_Origin, int a_Data) override;
virtual void SendSpawnEntity (const cEntity & a_Entity) override;
virtual void SendSpawnMob (const cMonster & a_Mob) override;
virtual void SendStatistics (const StatisticsManager & a_Manager) override;
virtual void SendTabCompletionResults (const AStringVector & a_Results) override;
- virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) override;
+ virtual void SendThunderbolt (Vector3i a_BlockPos) override;
virtual void SendTitleTimes (int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks) override;
virtual void SendTimeUpdate (cTickTimeLong a_WorldAge, cTickTimeLong a_WorldDate, bool a_DoDaylightCycle) override;
virtual void SendUnleashEntity (const cEntity & a_Entity) override;
virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override;
virtual void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity) override;
- virtual void 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) override;
+ virtual void SendUpdateSign (Vector3i a_BlockPos, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) override;
virtual void SendUnlockRecipe (UInt32 a_RecipeID) override;
virtual void SendInitRecipes (UInt32 a_RecipeID) override;
virtual void SendWeather (eWeather a_Weather) override;
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;
diff --git a/src/Protocol/Protocol_1_9.h b/src/Protocol/Protocol_1_9.h
index 6dfa51811..5f4bbed59 100644
--- a/src/Protocol/Protocol_1_9.h
+++ b/src/Protocol/Protocol_1_9.h
@@ -54,9 +54,9 @@ public:
virtual void SendPlayerMoveLook (void) override;
virtual void SendPlayerPermissionLevel() override;
virtual void SendPlayerSpawn (const cPlayer & a_Player) override;
- virtual void SendSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch) override;
+ virtual void SendSoundEffect (const AString & a_SoundName, Vector3d a_Origin, float a_Volume, float a_Pitch) override;
virtual void SendSpawnMob (const cMonster & a_Mob) override;
- virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) override;
+ virtual void SendThunderbolt (Vector3i a_Origin) override;
virtual void SendUnleashEntity (const cEntity & a_Entity) override;
virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override;
@@ -175,7 +175,7 @@ public:
protected:
- virtual void 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) override;
+ virtual void SendUpdateSign(Vector3i a_BlockPos, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) override;
virtual UInt32 GetPacketID(ePacketType a_Packet) const override;
virtual Version GetProtocolVersion() const override;