From 32b38fb2649fb282b6446c4e544866c0161aa7da Mon Sep 17 00:00:00 2001 From: mohe2015 Date: Sun, 6 Nov 2016 19:30:19 +0100 Subject: Anticheat fastbreak (#3411) Added block hardness checks when breaking blocks. --- src/Entities/Player.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/Entities/Player.h') diff --git a/src/Entities/Player.h b/src/Entities/Player.h index cc83b1ca2..3de1a4cb5 100644 --- a/src/Entities/Player.h +++ b/src/Entities/Player.h @@ -529,6 +529,12 @@ public: The player removes its m_ClientHandle ownership so that the ClientHandle gets deleted. */ void RemoveClientHandle(void); + /** Returns the relative block hardness for the block a_Block. + The bigger it is the faster the player can break the block. + Returns zero if the block is instant breakable. + Otherwise it returns the dig speed (float GetDigSpeed(BLOCKTYPE a_Block)) divided by the block hardness (cBlockInfo::GetHardness(BLOCKTYPE a_Block)) divided by 30 if the player can harvest the block and divided by 100 if he can't. */ + float GetPlayerRelativeBlockHardness(BLOCKTYPE a_Block); + protected: typedef std::vector > AStringVectorVector; @@ -710,4 +716,19 @@ private: /** Pins the player to a_Location until Unfreeze() is called. If ManuallyFrozen is false, the player will unfreeze when the chunk is loaded. */ void FreezeInternal(const Vector3d & a_Location, bool a_ManuallyFrozen); + + /** Returns how high the liquid is in percent. Used by IsInsideWater */ + float GetLiquidHeightPercent(NIBBLETYPE a_Meta); + + /** Checks if the player is inside of water */ + bool IsInsideWater(); + + /** Returns the dig speed using the current tool on the block a_Block. + Returns one if using hand. + If the player is using a tool that is good to break the block the value is higher. + If he has an enchanted tool with efficiency or he has a haste or mining fatique effect it gets multiplied by a specific factor depending on the strength of the effect or enchantment. + In he is in water it gets divided by 5 except his tool is enchanted with aqa affinity. + If he is not on ground it also gets divided by 5. */ + float GetDigSpeed(BLOCKTYPE a_Block); + } ; // tolua_export -- cgit v1.2.3