@@ -1931,7 +1931,7 @@ public function handleDataPacket(DataPacket $packet){
1931
1931
$ this ->actionsNum ['CRACK_BLOCK ' ] = 0 ;
1932
1932
if (!$ this ->isCreative ()) {
1933
1933
$ 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 );
1935
1935
$ fireBlock = $ block ->getSide ($ packet ->face );
1936
1936
if ($ fireBlock ->getId () === Block::FIRE ) {
1937
1937
$ fireBlock ->onUpdate (Level::BLOCK_UPDATE_TOUCH );
@@ -4344,7 +4344,7 @@ protected function crackBlock($packet) {
4344
4344
$ isNeedSendPackets = $ this ->actionsNum ['CRACK_BLOCK ' ] % 4 == 0 ;
4345
4345
$ this ->actionsNum ['CRACK_BLOCK ' ]++;
4346
4346
4347
- $ breakTime = ceil ($ block ->getBreakTime ($ this -> inventory -> getItemInHand () ) * 20 );
4347
+ $ breakTime = ceil ($ this ->getBreakTime ($ block ) * 20 );
4348
4348
if ($ this ->actionsNum ['CRACK_BLOCK ' ] >= $ breakTime ) {
4349
4349
$ this ->breakBlock ($ blockPos );
4350
4350
}
@@ -4364,6 +4364,17 @@ protected function crackBlock($packet) {
4364
4364
}
4365
4365
}
4366
4366
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
+
4367
4378
/**
4368
4379
* @minprotocol 120
4369
4380
* @param SimpleTransactionData[] $transactionsData
0 commit comments