1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved Block break time

Discussion in 'Development' started by Muqsit, Feb 24, 2018.

  1. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    I'm trying to modify block break time for coal ore.

    I overrode Block::getBreakTime(Item) to return 3 (i.e will take block 3 seconds to break).
    That made the block crack animation last for 3 seconds but didn't break the block once the block break animation ended.

    I've noticed Level::useBreakOn() being fired when the client sends InventoryTransactionEvent::USE_ITEM_ACTION_BREAK_BLOCK which isn't being sent once the modified block break animation ends.

    Am i missing something? Is there any way to modify a block's break time?
    PHP:
    <?php
    namespace spacename;

    use 
    pocketmine\block\CoalOre as PmCoalOre;

    class 
    CoalOre extends PmCoalOre{
        public function 
    getBreakTime(Item $item) : float{
            return 
    3;
        }
    }
     
    NickTehUnicorn likes this.
  2. dktapps

    dktapps Administrator Staff Member PMMP Team

    Messages:
    774
    GitHub:
    dktapps
  3. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Awesome, thanks!
     
    Last edited: Aug 17, 2018
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.