From cd1b50774512e09736b78df025163ab9b26bd528 Mon Sep 17 00:00:00 2001 From: KingCol13 <48412633+KingCol13@users.noreply.github.com> Date: Fri, 2 Oct 2020 23:57:17 +0300 Subject: Fix instant mining of blocks not being recognised, tweak anti-cheat (#4938) * Tried to fix a small issue... Ended up rewriting a bunch of god awful, opaque code with no source and no sense. Who names a function GetPlayerRelativeBlockHardness??? It's gone now. We're safe again. * Testing anti-cheat. * Tidy up debug logging. * Remove empty member declaration. * Rewrite GetDigSpeed slightly for better readability. * GetMiningProgressPerTick now returns 1 when instantly mined. Fixed hasily written typo. * Comment style and typo fixes. --- src/BlockInfo.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/BlockInfo.h') diff --git a/src/BlockInfo.h b/src/BlockInfo.h index f35df90ae..8962f6328 100644 --- a/src/BlockInfo.h +++ b/src/BlockInfo.h @@ -25,6 +25,9 @@ public: inline static NIBBLETYPE GetLightValue (BLOCKTYPE a_Type) { return Get(a_Type).m_LightValue; } inline static NIBBLETYPE GetSpreadLightFalloff(BLOCKTYPE a_Type) { return Get(a_Type).m_SpreadLightFalloff; } inline static bool IsTransparent (BLOCKTYPE a_Type) { return Get(a_Type).m_Transparent; } + /** Warning: IsOneHitDig does not take into account enchantments / status effects / swim state / floating state + and therefore may be incorrect. Only use to check if hardness is 0 + If you want to check if a player would instantly mine a_Block use cPlayer::CanInstantlyMine(a_Block) */ inline static bool IsOneHitDig (BLOCKTYPE a_Type) { return Get(a_Type).m_OneHitDig; } inline static bool IsPistonBreakable (BLOCKTYPE a_Type) { return Get(a_Type).m_PistonBreakable; } inline static bool IsRainBlocker (BLOCKTYPE a_Type) { return Get(a_Type).m_IsRainBlocker; } -- cgit v1.2.3