Removed entanglement between chunks and providers. WARNING: BREAKING API CHANGES.

- All entity and tile constructors now require a \pocketmine\level\Level instead of a \pocketmine\level\format\Chunk.
- Chunk->getProvider() and Chunk->setProvider() have been removed.
- Chunk::__construct() has had the $provider parameter removed.
- Chunk->unload() has had the unused $save parameter removed.
- ChunkEvents now take a Level parameter instead of going through the Chunk

API bump to 3.0.0-ALPHA4
This commit is contained in:
Dylan K. Taylor
2017-02-21 17:03:45 +00:00
parent 0a8826b21f
commit c21197ef17
37 changed files with 123 additions and 170 deletions

View File

@ -1726,7 +1726,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
$this->server->saveOfflinePlayerData($this->username, $nbt, true);
}
parent::__construct($this->level->getChunk($nbt["Pos"][0] >> 4, $nbt["Pos"][2] >> 4, true), $nbt);
parent::__construct($this->level, $nbt);
$this->loggedIn = true;
$this->server->addOnlinePlayer($this);
@ -2115,7 +2115,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
]);
$f = 1.5;
$snowball = Entity::createEntity("Snowball", $this->chunk, $nbt, $this);
$snowball = Entity::createEntity("Snowball", $this->getLevel(), $nbt, $this);
$snowball->setMotion($snowball->getMotion()->multiply($f));
if($this->isSurvival()){
$item->setCount($item->getCount() - 1);
@ -2200,7 +2200,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
$diff = ($this->server->getTick() - $this->startAction);
$p = $diff / 20;
$f = min((($p ** 2) + $p * 2) / 3, 1) * 2;
$ev = new EntityShootBowEvent($this, $bow, Entity::createEntity("Arrow", $this->chunk, $nbt, $this, $f == 2 ? true : false), $f);
$ev = new EntityShootBowEvent($this, $bow, Entity::createEntity("Arrow", $this->getLevel(), $nbt, $this, $f == 2 ? true : false), $f);
if($f < 0.1 or $diff < 5){
$ev->setCancelled();