@@ -1931,7 +1931,7 @@ public function handleDataPacket(DataPacket $packet){
19311931 $ this ->actionsNum ['CRACK_BLOCK ' ] = 0 ;
19321932 if (!$ this ->isCreative ()) {
19331933 $ block = $ this ->level ->getBlock (new Vector3 ($ packet ->x , $ packet ->y , $ packet ->z ));
1934- $ breakTime = ceil ($ block ->getBreakTime ($ this -> inventory -> getItemInHand () ) * 20 );
1934+ $ breakTime = ceil ($ this ->getBreakTime ($ block ) * 20 );
19351935 $ fireBlock = $ block ->getSide ($ packet ->face );
19361936 if ($ fireBlock ->getId () === Block::FIRE ) {
19371937 $ fireBlock ->onUpdate (Level::BLOCK_UPDATE_TOUCH );
@@ -4344,7 +4344,7 @@ protected function crackBlock($packet) {
43444344 $ isNeedSendPackets = $ this ->actionsNum ['CRACK_BLOCK ' ] % 4 == 0 ;
43454345 $ this ->actionsNum ['CRACK_BLOCK ' ]++;
43464346
4347- $ breakTime = ceil ($ block ->getBreakTime ($ this -> inventory -> getItemInHand () ) * 20 );
4347+ $ breakTime = ceil ($ this ->getBreakTime ($ block ) * 20 );
43484348 if ($ this ->actionsNum ['CRACK_BLOCK ' ] >= $ breakTime ) {
43494349 $ this ->breakBlock ($ blockPos );
43504350 }
@@ -4364,6 +4364,17 @@ protected function crackBlock($packet) {
43644364 }
43654365 }
43664366
4367+ public function getBreakTime (Block $ block , Item $ item = null ) {
4368+ $ item = $ item ??$ this ->inventory ->getItemInHand ();
4369+ $ breakTime = $ block ->getBreakTime ($ item );
4370+ $ blockUnderPlayer = $ this ->level ->getBlock (new Vector3 (floor ($ this ->x ), floor ($ this ->y ) - 1 , floor ($ this ->z )));
4371+
4372+ if ($ blockUnderPlayer ->getId () == Block::LADDER || $ blockUnderPlayer ->getId () == Block::VINE || !$ this ->onGround ) {
4373+ $ breakTime *= 5 ;
4374+ }
4375+ return $ breakTime ;
4376+ }
4377+
43674378 /**
43684379 * @minprotocol 120
43694380 * @param SimpleTransactionData[] $transactionsData
0 commit comments