summaryrefslogtreecommitdiffstats
path: root/source/ClientHandle.h
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-01-12 05:46:01 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-01-12 05:46:01 +0100
commit43e684071933adef93040e8d4b830d5c6b71cf9a (patch)
tree014e5300feb1cdbbb8f24e4e42594eeb841f0be2 /source/ClientHandle.h
parentFixed rclk in doublechests (diff)
downloadcuberite-43e684071933adef93040e8d4b830d5c6b71cf9a.tar
cuberite-43e684071933adef93040e8d4b830d5c6b71cf9a.tar.gz
cuberite-43e684071933adef93040e8d4b830d5c6b71cf9a.tar.bz2
cuberite-43e684071933adef93040e8d4b830d5c6b71cf9a.tar.lz
cuberite-43e684071933adef93040e8d4b830d5c6b71cf9a.tar.xz
cuberite-43e684071933adef93040e8d4b830d5c6b71cf9a.tar.zst
cuberite-43e684071933adef93040e8d4b830d5c6b71cf9a.zip
Diffstat (limited to 'source/ClientHandle.h')
-rw-r--r--source/ClientHandle.h41
1 files changed, 26 insertions, 15 deletions
diff --git a/source/ClientHandle.h b/source/ClientHandle.h
index 806224333..a413c6670 100644
--- a/source/ClientHandle.h
+++ b/source/ClientHandle.h
@@ -31,6 +31,7 @@ class cProtocol;
class cRedstone;
class cWindow;
class cFallingBlock;
+class cItemHandler;
@@ -63,7 +64,7 @@ public:
cPlayer* GetPlayer() { return m_Player; } // tolua_export
- void Kick(const AString & a_Reason); //tolua_export
+ void Kick(const AString & a_Reason); // tolua_export
void Authenticate(void); // Called by cAuthenticator when the user passes authentication
void StreamChunks(void);
@@ -125,15 +126,15 @@ public:
void SendWindowOpen (char a_WindowID, char a_WindowType, const AString & a_WindowTitle, char a_NumSlots);
void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ );
- const AString & GetUsername(void) const; //tolua_export
- void SetUsername( const AString & a_Username ); //tolua_export
+ const AString & GetUsername(void) const; // tolua_export
+ void SetUsername( const AString & a_Username ); // tolua_export
- inline short GetPing(void) const { return m_Ping; } //tolua_export
+ inline short GetPing(void) const { return m_Ping; } // tolua_export
void SetViewDistance(int a_ViewDistance); // tolua_export
int GetViewDistance(void) const { return m_ViewDistance; } // tolua_export
- int GetUniqueID() const { return m_UniqueID; } //tolua_export
+ int GetUniqueID() const { return m_UniqueID; } // tolua_export
/// Returns true if the client wants the chunk specified to be sent (in m_ChunksToSend)
bool WantsSendChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ);
@@ -150,8 +151,8 @@ public:
void HandlePing (void);
void HandleCreativeInventory(short a_SlotNum, const cItem & a_HeldItem);
void HandlePlayerPos (double a_PosX, double a_PosY, double a_PosZ, double a_Stance, bool a_IsOnGround);
- void HandleBlockDig (int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status);
- void HandleBlockPlace (int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, const cItem & a_HeldItem);
+ void HandleLeftClick (int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status);
+ void HandleRightClick (int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, const cItem & a_HeldItem);
void HandleChat (const AString & a_Message);
void HandlePlayerLook (float a_Rotation, float a_Pitch, bool a_IsOnGround);
void HandlePlayerMoveLook (double a_PosX, double a_PosY, double a_PosZ, double a_Stance, float a_Rotation, float a_Pitch, bool a_IsOnGround); // While m_bPositionConfirmed (normal gameplay)
@@ -221,16 +222,17 @@ private:
static const unsigned short PING_TIME_MS = 1000; //minecraft sends 1 per 20 ticks (1 second or every 1000 ms)
// Values required for block dig animation
- int m_BlockDigAnim; // Current stage of the animation; -1 if not digging
+ int m_BlockDigAnimStage; // Current stage of the animation; -1 if not digging
int m_BlockDigAnimSpeed; // Current speed of the animation (units ???)
- int m_BlockDigX;
- int m_BlockDigY;
- int m_BlockDigZ;
+ int m_BlockDigAnimX;
+ int m_BlockDigAnimY;
+ int m_BlockDigAnimZ;
- char m_LastDigStatus;
- int m_LastDigX;
- int m_LastDigY;
- int m_LastDigZ;
+ // 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;
enum eState
{
@@ -264,6 +266,15 @@ private:
/// Adds a single chunk to be streamed to the client; used by StreamChunks()
void StreamChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ);
+ /// Handles the DIG_STARTED dig packet:
+ void HandleBlockDigStarted (int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_OldBlock, NIBBLETYPE a_OldMeta);
+
+ /// Handles the DIG_FINISHED dig packet:
+ void HandleBlockDigFinished(int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_OldBlock, NIBBLETYPE a_OldMeta);
+
+ /// Handles the block placing packet when it is a real block placement (not block-using, item-using or eating)
+ void HandlePlaceBlock(int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, cItemHandler & a_ItemHandler);
+
// cSocketThreads::cCallback overrides:
virtual void DataReceived (const char * a_Data, int a_Size) override; // Data is received from the client
virtual void GetOutgoingData(AString & a_Data) override; // Data can be sent to client