Function: not: they are no error display in the console PHP: public function spawnTo(Player $player){ $pk = new AddEntityPacket(); $pk->type = Arrow::NETWORK_ID; $pk->eid = $this->getId(); $pk->x = $this->data['x']; $pk->y = $this->data['y']; $pk->z = $this->data['z']; $pk->speedX = $this->motionX; $pk->speedY = $this->motionY; $pk->speedZ = $this->motionZ; $pk->metadata = $this->dataProperties; $player->dataPacket($pk->setChannel(Network::CHANNEL_ENTITY_SPAWNING)); parent::spawnTo($player); } config: PHP: $dir = $this->getDataFolder(); @mkdir($dir); if(!file_exists($dir.'config.json')){ file_put_contents($dir.'config.json', '{"x":-40,"y":70,"z":-747}');
You sure there are no errors? The AddEntityPacket() code might not be executing then. What's $this->data by the way?
PHP: [21:19:00] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\player\PlayerJoinEvent' to 'DarkFactionCore v1': Class 'pocketmine\network\protocol\AddEntityPacket' not found on DarkFactionCore\Main[21:19:00] [Server thread/CRITICAL]: Error: "Class 'pocketmine\network\protocol\AddEntityPacket' not found" (EXCEPTION) in "DarkFactionCore-MASTER/src/DarkFactionCore/Main" at line 98 Class: PHP: #Packetuse pocketmine\network\protocol\{AddEntityPacket, ExplodePacket, RemoveEntityPacket, UseItemPacket};
I'm assuming you're using an old plugin as a reference. Some stuff in AddEntityPacket was changed over time. Check Entity::sendSpawnPacket() for how it's currently being used.
Sa Correct? PHP: public function sendTo(PlayerJoinEvent $event){ $p = $event->getPlayer(); $pk = new AddEntityPacket(); $pk->type = 71; $pk->eid = Entity::$entityCount++; $pk->metadata = array(); $pk->yaw = 0; $pk->pitch = 0; $pk->x = $this->data['x']; $pk->y = $this->data['y']; $pk->z = $this->data['z']; $p->dataPacket($pk); }
How can l define $item PHP: public function crystal(PlayerJoinEvent $e){ $p = $e->getPlayer(); $pk = new AddEntityPacket(); $pk->type = 61; $pk->entityRuntimeId = Entity::$entityCount++; $pk->metadata = array(); $pk->yaw = 0; $pk->pitch = 0; $pk->position = new \pocketmine\math\Vector3($this->data['x'] + 0.5 , $this->data['y'], $this->data['z'] + 0.5); $p->dataPacket($pk); $p->getLevel()->addParticle(new FloatingTextParticle(new Vector3($this->data['x'] + 0.5 , $this->data['y'] + 2, $this->data['z'] + 0.5), '', $this->data['text'])); $p = $e->getPlayer(); $pk = new AddItemEntityPacket(); $pk->type = 267; $pk->entityRuntimeId = Entity::$entityCount++; $pk->item = $this->item; $pk->metadata = 0; $pk->motion = 0; $pk->yaw = 0; $pk->pitch = 0; $pk->position = new \pocketmine\math\Vector3($this->data['x'] + 0.5 , $this->data['y'] + 3, $this->data['z'] + 0.5); $p->dataPacket($pk);}}[19:33:08] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\player\PlayerJoinEvent' to 'EnderCrystal v1': Undefined property: armthedev\ender_crystal\main::$item on armthedev\ender_crystal\main[19:33:08] [Server thread/CRITICAL]: ErrorException: "Undefined property: armthdev\ender_crystal\main::$item" (EXCEPTION) in "EnderCrystal-master/src/armthedev/ender_crystal/main" at line 47