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

Solved How to use new AddEntityPacket ?

Discussion in 'Plugin Help' started by isPops, Jul 14, 2019.

  1. isPops

    isPops Silverfish

    Messages:
    19
    I was looking at source and I can't understand why this one was changed and stripped most of the important parts. I looked at AddActorPacket and the variables I need are there but not in AddEntityPacket, is there a workaround or a new way of using this packet please let me know *smiley face*
     
  2. isPops

    isPops Silverfish

    Messages:
    19
    I found out how to do it all you have to do is change use
    PHP:
    use pocketmine\network\mcpe\protocol\AddEntityPacket;
    to either the faster way
    Code:
    use pocketmine\network\mcpe\protocol\AddActorPacket as AddEntityPacket;
    or better change all your code EXAMPLE:
    Code:
    case "polarbear":
                    //player manager
                    $player->teleport(new Vector3(0 + 0.5,63,89 + 0.5));
                    $player->setImmobile(true);
    
                    //spawn entity
                    $pk = new AddActorPacket();
                    $pk->type = 28;
                    $pk->entityRuntimeId = 500;
                    $pk->yaw = 180;
                    $pk->headYaw = 180;
                    $pk->pitch = 0;
                    $pk->position = new Vector3(0 + 0.5, 63, 93 + 0.5);
                    $this->plugin->getServer()->broadcastPacket([$player], $pk);
                    return true;
     
  3. MC ATECH

    MC ATECH Baby Zombie

    Messages:
    117
    GitHub:
    mcpeatech
    All of the code shown above is correct for pocketmine builds under 3.9.0... In 3.9.0 it is no longer and entity packet but an actor packet.. Hope this helps :)
     
  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.