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: <?phpnamespace spacename;use pocketmine\block\CoalOre as PmCoalOre;class CoalOre extends PmCoalOre{ public function getBreakTime(Item $item) : float{ return 3; }}
Not conveniently. The block breaking time is client-dependent. You could run a scheduled task to delete the block X ticks after the player started to break it. That's how I did this: https://twitter.com/dktapps/status/879322956119388160