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

Solved Mining animation packet

Discussion in 'Development' started by SkyZone, Aug 20, 2018.

  1. SkyZone

    SkyZone Slime

    Messages:
    95
    Which packet could I use to create an mining animation like this:
    https://prnt.sc/kkmsmv

    I tried LevelEventPacket START BREAK, but it did just the first state.
    PHP:
    $pk = new LevelEventPacket();
                    
    $pk->evid LevelEventPacket::EVENT_BLOCK_START_BREAK;
                    
    $pk->position $event->getBlock()->asVector3();

                    
    $game $this->plugin->getGameOfPlayer($player);

                    
    $game->playerone->sendDataPacket($pk);
                    
    $game->playertwo->sendDataPacket($pk);

                    
    $this->plugin->getScheduler()->scheduleDelayedTask(new BreakBlockTask($event->getBlock(), $game1$this->plugin), 5);
     
  2. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    End it with LevelEventPacket::STOP_BREAK?
     
  3. SkyZone

    SkyZone Slime

    Messages:
    95
    But it will just end it?
     
  4. Heisenborger

    Heisenborger Spider

    Messages:
    9
    You are missing the break time

    https://github.com/pmmp/PocketMine-...fcb961b85e482/src/pocketmine/Player.php#L2190

    https://github.com/pmmp/PocketMine-...61b85e482/src/pocketmine/level/Level.php#L476

    Yes LevelEventPacket::EVENT_BLOCK_STOP_BREAK just stops it
     
    SkyZone likes this.
  5. SkyZone

    SkyZone Slime

    Messages:
    95
    Thanks! This worked for me:
    PHP:
    $pk = new LevelEventPacket();
                    
    $pk->evid LevelEventPacket::EVENT_BLOCK_START_BREAK;
                    
    $pk->position $event->getBlock()->asVector3();
                    
    $pk->data = (int)round(65535 60);

                    
    $game $this->plugin->getGameOfPlayer($player);

                    
    $game->playerone->sendDataPacket($pk);
                    
    $game->playertwo->sendDataPacket($pk);
     
  6. tungstenvm

    tungstenvm Witch

    Messages:
    54
    how to freeze the animation, LevelEventPacket::EVENT_BLOCK_START_BREAK will remove the animation,not freezing it
     
  7. NTT

    NTT Zombie

    Messages:
    311
    GitHub:
    NTT1906
    i think you can't?
     
  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.