Modified Level and Chunk deprecated methods

This commit is contained in:
Shoghi Cervantes 2014-08-06 16:22:28 +02:00
parent 232bf5ebe4
commit 269a10fadd
4 changed files with 18 additions and 13 deletions

View File

@ -61,7 +61,7 @@ class SetWorldSpawnCommand extends VanillaCommand{
return true;
}
$level->setSpawn($pos);
$level->setSpawnLocation($pos);
Command::broadcastCommandMessage($sender, "Set world " . $level->getName() . "'s spawnpoint to " . $pos->x . ", " . $pos->y . ", " . $pos->z);

View File

@ -148,7 +148,7 @@ abstract class Entity extends Position implements Metadatable{
public function __construct(FullChunk $chunk, Compound $nbt){
if($chunk->getLevel() === null){
if($chunk->getProvider() === null){
throw new \Exception("Invalid garbage Chunk given to Entity");
}
@ -156,21 +156,23 @@ abstract class Entity extends Position implements Metadatable{
$this->justCreated = true;
$this->namedtag = $nbt;
$this->chunk = $chunk;
$this->setLevel($chunk->getLevel()->getLevel(), true); //Create a hard reference
$this->server = $chunk->getLevel()->getLevel()->getServer();
$this->setLevel($chunk->getProvider()->getLevel(), true); //Create a hard reference
$this->server = $chunk->getProvider()->getLevel()->getServer();
$this->boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0);
$this->setPositionAndRotation(new Vector3(
$this->setPositionAndRotation(
new Vector3(
$this->namedtag["Pos"][0],
$this->namedtag["Pos"][1],
$this->namedtag["Pos"][2]),
$this->namedtag["Pos"][2]
),
$this->namedtag->Rotation[0],
$this->namedtag->Rotation[1]
);
$this->setMotion(new Vector3(
$this->namedtag["Motion"][0],
$this->namedtag["Motion"][1],
$this->namedtag["Motion"][2])
$this->namedtag["Motion"][0],
$this->namedtag["Motion"][1],
$this->namedtag["Motion"][2])
);
if(!isset($this->namedtag->FallDistance)){
@ -235,6 +237,9 @@ abstract class Entity extends Position implements Metadatable{
protected abstract function initEntity();
/**
* @return Player[]
*/
public function getViewers(){
return $this->hasSpawned;
}

View File

@ -34,7 +34,7 @@ abstract class ChunkEvent extends LevelEvent{
* @param FullChunk $chunk
*/
public function __construct(FullChunk $chunk){
parent::__construct($chunk->getLevel()->getLevel());
parent::__construct($chunk->getProvider()->getLevel());
$this->chunk = $chunk;
}

View File

@ -64,13 +64,13 @@ abstract class Tile extends Position{
public $tickTimer;
public function __construct(FullChunk $chunk, Compound $nbt){
if($chunk->getLevel() === null){
if($chunk->getProvider() === null){
throw new \Exception("Invalid garbage Chunk given to Tile");
}
$this->server = $chunk->getLevel()->getLevel()->getServer();
$this->server = $chunk->getProvider()->getLevel()->getServer();
$this->chunk = $chunk;
$this->setLevel($chunk->getLevel()->getLevel(), true); //Strong reference
$this->setLevel($chunk->getProvider()->getLevel(), true); //Strong reference
$this->namedtag = $nbt;
$this->closed = false;
$this->name = "";