getProvider() public method

public getProvider ( ) : pocketmine\level\format\LevelProvider
return pocketmine\level\format\LevelProvider
コード例 #1
0
ファイル: Tile.php プロジェクト: boybook/PocketMine-MP
 public function __construct(FullChunk $chunk, Compound $nbt)
 {
     if ($chunk === null or $chunk->getProvider() === null) {
         throw new \Exception("Invalid garbage Chunk given to Tile");
     }
     $this->server = $chunk->getProvider()->getLevel()->getServer();
     $this->chunk = $chunk;
     $this->setLevel($chunk->getProvider()->getLevel());
     $this->namedtag = $nbt;
     $this->closed = false;
     $this->name = "";
     $this->lastUpdate = microtime(true);
     $this->id = Tile::$tileCount++;
     $this->x = (int) $this->namedtag["x"];
     $this->y = (int) $this->namedtag["y"];
     $this->z = (int) $this->namedtag["z"];
     $this->chunk->addTile($this);
     $this->getLevel()->addTile($this);
     $this->tickTimer = Timings::getTileEntityTimings($this);
 }
コード例 #2
0
ファイル: Entity.php プロジェクト: RedstoneAlmeida/Steadfast2
 public function __construct(FullChunk $chunk, Compound $nbt)
 {
     if ($chunk === null or $chunk->getProvider() === null) {
         throw new ChunkException("Invalid garbage Chunk given to Entity");
     }
     $this->timings = Timings::getEntityTimings($this);
     if ($this->eyeHeight === null) {
         $this->eyeHeight = $this->height / 2 + 0.1;
     }
     $this->id = Entity::$entityCount++;
     $this->justCreated = true;
     $this->namedtag = $nbt;
     $this->chunk = $chunk;
     $this->setLevel($chunk->getProvider()->getLevel());
     $this->server = $chunk->getProvider()->getLevel()->getServer();
     $this->boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
     $this->setPositionAndRotation(new Vector3($this->namedtag["Pos"][0], $this->namedtag["Pos"][1], $this->namedtag["Pos"][2]), $this->namedtag->Rotation[0], $this->namedtag->Rotation[1], true);
     $this->setMotion(new Vector3($this->namedtag["Motion"][0], $this->namedtag["Motion"][1], $this->namedtag["Motion"][2]));
     if (!isset($this->namedtag->FallDistance)) {
         $this->namedtag->FallDistance = new Float("FallDistance", 0);
     }
     $this->fallDistance = $this->namedtag["FallDistance"];
     if (!isset($this->namedtag->Fire)) {
         $this->namedtag->Fire = new Short("Fire", 0);
     }
     $this->fireTicks = $this->namedtag["Fire"];
     if (!isset($this->namedtag->Air)) {
         $this->namedtag->Air = new Short("Air", 300);
     }
     $this->setDataProperty(self::DATA_AIR, self::DATA_TYPE_SHORT, $this->namedtag["Air"]);
     if (!isset($this->namedtag->OnGround)) {
         $this->namedtag->OnGround = new Byte("OnGround", 0);
     }
     $this->onGround = $this->namedtag["OnGround"] > 0 ? true : false;
     if (!isset($this->namedtag->Invulnerable)) {
         $this->namedtag->Invulnerable = new Byte("Invulnerable", 0);
     }
     $this->invulnerable = $this->namedtag["Invulnerable"] > 0 ? true : false;
     $this->chunk->addEntity($this);
     $this->level->addEntity($this);
     $this->initEntity();
     $this->lastUpdate = $this->server->getTick();
     $this->server->getPluginManager()->callEvent(new EntitySpawnEvent($this));
     $this->checkBlockCollisionTicks = (int) $this->server->getAdvancedProperty("main.check-block-collision", 1);
     $this->scheduleUpdate();
 }
コード例 #3
0
ファイル: Tile.php プロジェクト: ClearSkyTeam/ClearSky
 public function __construct(FullChunk $chunk, CompoundTag $nbt)
 {
     assert($chunk !== null and $chunk->getProvider() !== null);
     $this->timings = Timings::getTileEntityTimings($this);
     $this->server = $chunk->getProvider()->getLevel()->getServer();
     $this->chunk = $chunk;
     $this->setLevel($chunk->getProvider()->getLevel());
     $this->namedtag = $nbt;
     $this->name = "";
     $this->lastUpdate = microtime(true);
     $this->id = Tile::$tileCount++;
     $this->x = (int) $this->namedtag["x"];
     $this->y = (int) $this->namedtag["y"];
     $this->z = (int) $this->namedtag["z"];
     $this->chunk->addTile($this);
     $this->getLevel()->addTile($this);
     $this->tickTimer = Timings::getTileEntityTimings($this);
 }
コード例 #4
0
ファイル: Entity.php プロジェクト: robske110/ClearSky
 public function __construct(FullChunk $chunk, CompoundTag $nbt)
 {
     assert($chunk !== null and $chunk->getProvider() !== null);
     $this->timings = Timings::getEntityTimings($this);
     $this->isPlayer = $this instanceof Player;
     $this->temporalVector = new Vector3();
     if ($this->eyeHeight === null) {
         $this->eyeHeight = $this->height / 2 + 0.1;
     }
     $this->id = Entity::$entityCount++;
     $this->justCreated = true;
     $this->namedtag = $nbt;
     $this->chunk = $chunk;
     $this->setLevel($chunk->getProvider()->getLevel());
     $this->server = $chunk->getProvider()->getLevel()->getServer();
     $this->boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
     $this->setPositionAndRotation($this->temporalVector->setComponents($this->namedtag["Pos"][0], $this->namedtag["Pos"][1], $this->namedtag["Pos"][2]), $this->namedtag->Rotation[0], $this->namedtag->Rotation[1]);
     $this->setMotion($this->temporalVector->setComponents($this->namedtag["Motion"][0], $this->namedtag["Motion"][1], $this->namedtag["Motion"][2]));
     assert(!is_nan($this->x) and !is_infinite($this->x) and !is_nan($this->y) and !is_infinite($this->y) and !is_nan($this->z) and !is_infinite($this->z));
     if (!isset($this->namedtag->FallDistance)) {
         $this->namedtag->FallDistance = new FloatTag("FallDistance", 0);
     }
     $this->fallDistance = $this->namedtag["FallDistance"];
     if (!isset($this->namedtag->Fire) || $this->namedtag["Fire"] > 32767) {
         $this->namedtag->Fire = new ShortTag("Fire", 0);
     }
     $this->fireTicks = $this->namedtag["Fire"];
     if (!isset($this->namedtag->Air)) {
         $this->namedtag->Air = new ShortTag("Air", 300);
     }
     $this->setDataProperty(self::DATA_AIR, self::DATA_TYPE_SHORT, $this->namedtag["Air"], false);
     if (!isset($this->namedtag->OnGround)) {
         $this->namedtag->OnGround = new ByteTag("OnGround", 0);
     }
     $this->onGround = $this->namedtag["OnGround"] > 0 ? true : false;
     if (!isset($this->namedtag->Invulnerable)) {
         $this->namedtag->Invulnerable = new ByteTag("Invulnerable", 0);
     }
     $this->invulnerable = $this->namedtag["Invulnerable"] > 0 ? true : false;
     $this->attributeMap = new AttributeMap();
     $this->chunk->addEntity($this);
     $this->level->addEntity($this);
     $this->initEntity();
     $this->lastUpdate = $this->server->getTick();
     $this->server->getPluginManager()->callEvent(new EntitySpawnEvent($this));
     $this->scheduleUpdate();
 }
コード例 #5
0
 /**
  * @param FullChunk $chunk
  */
 public function __construct(FullChunk $chunk)
 {
     parent::__construct($chunk->getProvider()->getLevel());
     $this->chunk = $chunk;
 }
コード例 #6
0
ファイル: Entity.php プロジェクト: boybook/PocketMine-MP
 public function __construct(FullChunk $chunk, Compound $nbt)
 {
     if ($chunk === null or $chunk->getProvider() === null) {
         throw new \Exception("Invalid garbage Chunk given to Entity");
     }
     if ($this->eyeHeight === null) {
         $this->eyeHeight = $this->height;
     }
     $this->id = Entity::$entityCount++;
     $this->justCreated = true;
     $this->namedtag = $nbt;
     $this->chunk = $chunk;
     $this->setLevel($chunk->getProvider()->getLevel());
     $this->server = $chunk->getProvider()->getLevel()->getServer();
     $this->boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
     $this->setPositionAndRotation(new Vector3($this->namedtag["Pos"][0], $this->namedtag["Pos"][1], $this->namedtag["Pos"][2]), $this->namedtag->Rotation[0], $this->namedtag->Rotation[1], true);
     $this->setMotion(new Vector3($this->namedtag["Motion"][0], $this->namedtag["Motion"][1], $this->namedtag["Motion"][2]));
     if (!isset($this->namedtag->FallDistance)) {
         $this->namedtag->FallDistance = new Float("FallDistance", 0);
     }
     $this->fallDistance = $this->namedtag["FallDistance"];
     if (!isset($this->namedtag->Fire)) {
         $this->namedtag->Fire = new Short("Fire", 0);
     }
     $this->fireTicks = $this->namedtag["Fire"];
     if (!isset($this->namedtag->Air)) {
         $this->namedtag->Air = new Short("Air", 300);
     }
     $this->airTicks = $this->namedtag["Air"];
     if (!isset($this->namedtag->OnGround)) {
         $this->namedtag->OnGround = new Byte("OnGround", 1);
     }
     $this->onGround = $this->namedtag["OnGround"] > 0 ? true : false;
     if (!isset($this->namedtag->Invulnerable)) {
         $this->namedtag->Invulnerable = new Byte("Invulnerable", 0);
     }
     $this->invulnerable = $this->namedtag["Invulnerable"] > 0 ? true : false;
     $this->chunk->addEntity($this);
     $this->getLevel()->addEntity($this);
     $this->initEntity();
     $this->lastUpdate = $this->spawnTime = microtime(true);
     $this->server->getPluginManager()->callEvent(new EntitySpawnEvent($this));
     $this->scheduleUpdate();
 }
コード例 #7
0
 private function entityConstruct(Player $player, FullChunk $chunk, CompoundTag $nbt)
 {
     assert($chunk !== null and $chunk->getProvider() !== null);
     $this->setPrivateVariableData($player, 'timings', Timings::getEntityTimings($player));
     $this->setPrivateVariableData($player, 'isPlayer', $player instanceof Player);
     $player->temporalVector = new Vector3();
     if ($player->eyeHeight === null) {
         $player->eyeHeight = $player->height / 2 + 0.1;
     }
     $this->setPrivateVariableData($player, 'id', Entity::$entityCount++);
     $this->setPrivateVariableData($player, 'justCreated', true);
     $player->namedtag = $nbt;
     $player->chunk = $chunk;
     $player->setLevel($chunk->getProvider()->getLevel());
     $this->setPrivateVariableData($player, 'server', $chunk->getProvider()->getLevel()->getServer());
     $player->boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
     $player->setPositionAndRotation($player->temporalVector->setComponents($player->namedtag["Pos"][0], $player->namedtag["Pos"][1], $player->namedtag["Pos"][2]), $player->namedtag->Rotation[0], $player->namedtag->Rotation[1]);
     $player->setMotion($player->temporalVector->setComponents($player->namedtag["Motion"][0], $player->namedtag["Motion"][1], $player->namedtag["Motion"][2]));
     assert(!is_nan($player->x) and !is_infinite($player->x) and !is_nan($player->y) and !is_infinite($player->y) and !is_nan($player->z) and !is_infinite($player->z));
     if (!isset($player->namedtag->FallDistance)) {
         $player->namedtag->FallDistance = new FloatTag("FallDistance", 0);
     }
     $player->fallDistance = $player->namedtag["FallDistance"];
     if (!isset($player->namedtag->Fire)) {
         $player->namedtag->Fire = new ShortTag("Fire", 0);
     }
     $player->fireTicks = $player->namedtag["Fire"];
     if (!isset($player->namedtag->Air)) {
         $player->namedtag->Air = new ShortTag("Air", 300);
     }
     $player->setDataProperty($player::DATA_AIR, $player::DATA_TYPE_SHORT, $player->namedtag["Air"]);
     if (!isset($player->namedtag->OnGround)) {
         $player->namedtag->OnGround = new ByteTag("OnGround", 0);
     }
     $player->onGround = $player->namedtag["OnGround"] > 0 ? true : false;
     if (!isset($player->namedtag->Invulnerable)) {
         $player->namedtag->Invulnerable = new ByteTag("Invulnerable", 0);
     }
     $player->invulnerable = $player->namedtag["Invulnerable"] > 0 ? true : false;
     $player->chunk->addEntity($player);
     $player->level->addEntity($player);
     $this->initialHuman($player);
     $player->lastUpdate = $this->server->getTick();
     $this->server->getPluginManager()->callEvent(new EntitySpawnEvent($player));
     $player->scheduleUpdate();
 }