From 5ea7675eca4fe50feed7fc4b871075f8c937d8b1 Mon Sep 17 00:00:00 2001 From: x12xx12x <44411062+12xx12@users.noreply.github.com> Date: Tue, 19 Apr 2022 20:30:12 +0200 Subject: Updated protocol functions to Vector3x also added support in included functions --- src/ClientHandle.h | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) (limited to 'src/ClientHandle.h') diff --git a/src/ClientHandle.h b/src/ClientHandle.h index 612883e46..927f0bfc8 100644 --- a/src/ClientHandle.h +++ b/src/ClientHandle.h @@ -150,9 +150,9 @@ public: // tolua_export // The following functions send the various packets: // (Please keep these alpha-sorted) void SendAttachEntity (const cEntity & a_Entity, const cEntity & a_Vehicle); - void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType); - void SendBlockBreakAnim (UInt32 a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage); // tolua_export - void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); // tolua_export + void SendBlockAction (Vector3i a_BlockPos, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType); + void SendBlockBreakAnim (UInt32 a_EntityID, Vector3i a_BlockPos, char a_Stage); // tolua_export + void SendBlockChange (Vector3i a_BlockPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta); // tolua_export void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes); 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); // tolua_export void SendBossBarUpdateFlags (UInt32 a_UniqueID, bool a_DarkenSky, bool a_PlayEndMusic, bool a_CreateFog); // tolua_export @@ -174,7 +174,7 @@ public: // tolua_export void SendDetachEntity (const cEntity & a_Entity, const cEntity & a_PreviousVehicle); // tolua_export void SendDisconnect (const AString & a_Reason); void SendDisplayObjective (const AString & a_Objective, cScoreboard::eDisplaySlot a_Display); - void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ); // tolua_export + void SendEditSign (Vector3i a_BlockPos); // tolua_export void SendEntityAnimation (const cEntity & a_Entity, EntityAnimation a_Animation); // tolua_export void SendEntityEffect (const cEntity & a_Entity, int a_EffectID, int a_Amplifier, int a_Duration); void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item); @@ -195,7 +195,7 @@ public: // tolua_export void SendLeashEntity (const cEntity & a_Entity, const cEntity & a_EntityLeashedTo); // tolua_export void SendMapData (const cMap & a_Map, int a_DataStartX, int a_DataStartY); void SendPaintingSpawn (const cPainting & a_Painting); - 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); + void SendParticleEffect (const AString & a_ParticleName, Vector3f a_Source, Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount); void SendParticleEffect (const AString & a_ParticleName, const Vector3f a_Src, const Vector3f a_Offset, float a_ParticleData, int a_ParticleAmount, std::array a_Data); void SendPlayerAbilities (void); void SendPlayerListAddPlayer (const cPlayer & a_Player); @@ -222,18 +222,18 @@ public: // tolua_export void SendSetRawTitle (const AString & a_Title); // tolua_export void SendSoundEffect (const AString & a_SoundName, double a_X, double a_Y, double a_Z, float a_Volume, float a_Pitch); // tolua_export void SendSoundEffect (const AString & a_SoundName, Vector3d a_Position, float a_Volume, float a_Pitch); // tolua_export - void SendSoundParticleEffect (const EffectID a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data); + void SendSoundParticleEffect (const EffectID a_EffectID, Vector3i a_Source, int a_Data); void SendSpawnEntity (const cEntity & a_Entity); void SendSpawnMob (const cMonster & a_Mob); void SendStatistics (const StatisticsManager & a_Manager); void SendTabCompletionResults (const AStringVector & a_Results); - void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ); // tolua_export + void SendThunderbolt (Vector3i a_BlockPos); // tolua_export void SendTitleTimes (int a_FadeInTicks, int a_DisplayTicks, int a_FadeOutTicks); // tolua_export void SendTimeUpdate (cTickTimeLong a_WorldAge, cTickTimeLong a_WorldDate, bool a_DoDaylightCycle); void SendUnleashEntity (const cEntity & a_Entity); // tolua_export void SendUnloadChunk (int a_ChunkX, int a_ChunkZ); void SendUpdateBlockEntity (cBlockEntity & a_BlockEntity); - 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); + void SendUpdateSign (Vector3i a_BlockPos, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4); /** Send a newly discovered recipe to show the notification and unlock in the recipe book */ void SendUnlockRecipe (UInt32 a_RecipeId); @@ -324,7 +324,7 @@ public: // tolua_export /** Called when the protocol receives a message, indicating that the player set a new command in the command block UI, for a block-based commandblock. */ - void HandleCommandBlockBlockChange(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_NewCommand); + void HandleCommandBlockBlockChange(Vector3i a_BlockPos, const AString & a_NewCommand); /** Called when the protocol receives a message, indicating that the player set a new command in the command block UI, for an entity-based commandblock (minecart?). */ @@ -354,7 +354,7 @@ public: // tolua_export void HandleLeaveBed(); void HandleKeepAlive (UInt32 a_KeepAliveID); - void HandleLeftClick (int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, UInt8 a_Status); + void HandleLeftClick (Vector3i a_BlockPos, eBlockFace a_BlockFace, UInt8 a_Status); /** Called when the protocol receives a MC|TrSel packet, indicating that the player used a trade in the NPC UI. */ @@ -377,7 +377,7 @@ public: // tolua_export void HandlePluginMessage (const AString & a_Channel, ContiguousByteBufferView a_Message); void HandleRespawn (void); - void HandleRightClick (int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, bool a_UsedMainHand); + void HandleRightClick (Vector3i a_BlockPos, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, bool a_UsedMainHand); void HandleSlotSelected (Int16 a_SlotNum); void HandleSpectate (const cUUID & a_PlayerUUID); @@ -390,7 +390,7 @@ public: // tolua_export void HandleSteerVehicle (float Forward, float Sideways); void HandleTabCompletion (const AString & a_Text); void HandleUpdateSign ( - int a_BlockX, int a_BlockY, int a_BlockZ, + Vector3i a_BlockPos, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4 ); @@ -507,15 +507,11 @@ private: // Values required for block dig animation int m_BlockDigAnimStage; // Current stage of the animation; -1 if not digging int m_BlockDigAnimSpeed; // Current speed of the animation (units ???) - int m_BlockDigAnimX; - int m_BlockDigAnimY; - int m_BlockDigAnimZ; + Vector3i m_BlockDigAnimPos; // To avoid dig / aim bug in the client, store the last position given in a DIG_START packet and compare to that when processing the DIG_FINISH packet: bool m_HasStartedDigging; - int m_LastDigBlockX; - int m_LastDigBlockY; - int m_LastDigBlockZ; + Vector3i m_LastDigBlockPos; enum eState { @@ -586,10 +582,10 @@ private: void StreamChunk(int a_ChunkX, int a_ChunkZ, cChunkSender::Priority a_Priority); /** Handles the DIG_STARTED dig packet: */ - void HandleBlockDigStarted (int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace); + void HandleBlockDigStarted (Vector3i a_BlockPos, eBlockFace a_BlockFace); /** Handles the DIG_FINISHED dig packet: */ - void HandleBlockDigFinished(int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace); + void HandleBlockDigFinished(Vector3i a_BlockPos, eBlockFace a_BlockFace); /** The clients will receive a finished dig animation */ void FinishDigAnimation(); -- cgit v1.2.3