diff --git a/src/network/UDPSocket.php b/src/network/UDPSocket.php index 6a3263d0..7505d454 100644 --- a/src/network/UDPSocket.php +++ b/src/network/UDPSocket.php @@ -50,6 +50,6 @@ class UDPSocket{ return false; } - return @socket_sendto($this->sock, $data, strlen($data), 0, $dest, $port); + return socket_sendto($this->sock, $data, strlen($data), MSG_DONTROUTE, $dest, $port); } } \ No newline at end of file diff --git a/src/network/protocol/packet/MoveEntityPacket_PosRot.php b/src/network/protocol/packet/MoveEntityPacket_PosRot.php index c885d213..c2143c18 100644 --- a/src/network/protocol/packet/MoveEntityPacket_PosRot.php +++ b/src/network/protocol/packet/MoveEntityPacket_PosRot.php @@ -13,7 +13,13 @@ class MoveEntityPacket_PosRot extends RakNetDataPacket{ } public function decode(){ - + $this->get(7); + $this->eid = $this->getInt(); + $this->x = $this->getFloat(); + $this->y = $this->getFloat(); + $this->z = $this->getFloat(); + $this->yaw = $this->getFloat(); + $this->pitch = $this->getFloat(); } public function encode(){ diff --git a/src/network/protocol/packet/RotateHeadPacket.php b/src/network/protocol/packet/RotateHeadPacket.php index 33a5324a..ea1ea298 100644 --- a/src/network/protocol/packet/RotateHeadPacket.php +++ b/src/network/protocol/packet/RotateHeadPacket.php @@ -15,7 +15,9 @@ class RotateHeadPacket extends RakNetDataPacket{ } public function decode(){ - + $this->get(7); //id + data + $this->eid = $this->getInt(); + $this->yaw = $this->getByte(); } public function encode(){ diff --git a/src/world/MobSpawner.php b/src/world/MobSpawner.php index 3bfca39c..25f4e42d 100644 --- a/src/world/MobSpawner.php +++ b/src/world/MobSpawner.php @@ -3,7 +3,7 @@ class MobSpawner{ private $server; public $level; - const MOB_LIMIT = 25; //constant for now + const MOB_LIMIT = 50; //constant for now public function __construct(Level $level){ $this->server = ServerAPI::request(); $this->level = $level; @@ -20,8 +20,7 @@ class MobSpawner{ } public function handle(){ - return false; - if($this->countEntities() > self::MOB_LIMIT && count($this->level->players) <= 0){ + if($this->countEntities() > self::MOB_LIMIT || count($this->level->players) <= 0){ return false; //not spawning } return $this->spawnMobs(); @@ -46,7 +45,7 @@ class MobSpawner{ if(!$y || $y < 0){ return false; } - $data = $this->genPosData($x, $y, $z); + $data = $this->genPosData($x, $y + 1, $z); if($baby != 2) $data["IsBaby"] = $baby; $e = $this->server->api->entity->add($this->level, 2, $type, $data); if($e instanceof Entity){