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

Apply Custom Animation to an Entity

Discussion in 'Development' started by David Flash, Dec 15, 2020.

  1. David Flash

    David Flash Spider Jockey

    Messages:
    26
    GitHub:
    davidflashcz
    I have custom animation in my server resource pack. I know that I have to use AnimateEntityPacket, but again, I don't know how.

    My Attempt:
    PHP:
    foreach($this->main->getServer()->getLevelByName("AdventureSurvival-Quest-AlongTimeAgo")->getEntities() as $entity){
                   if(
    $entity->getNameTag() === "§9Nightlight"){
                     
    $pk = new AnimateEntityPacket;
                     
    $pk->create("animation.npc.wave_nosound"$pk->getNextState(), $pk->getStopExpression(), $pk->getController(), $pk->getBlendOutTime(), [$entity->getId()]);
                     
    $this->main->getServer()->broadcastPacket($pk);
                   }
                 }
     
  2. Nathanael798

    Nathanael798 Creeper

    Messages:
    1
    y si pones la ruta?
     
  3. Kostamax-27

    Kostamax-27 Creeper

    Messages:
    2
    GitHub:
    kostamax27
    PHP:
    public function onRun(int $currentTick){
            foreach (
    Server::getInstance()->getLevels() as $level) {
                foreach(
    $level->getEntities() as $NPC) {
                    if (
    $NPC instanceof TestEntity) {
                        foreach (
    NPC::$emotes as $emote => $id) {
                            
    Server::getInstance()->broadcastPacket($NPC->getViewers(), EmotePacket::create($NPC->getId(), $id<< 0));
                        }
                    }
                }
            }
        }
    It should seem to work :)
     
  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.