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

@ -134,7 +134,6 @@ class Anvil extends McRegion{
}
$result = new Chunk(
$this,
$chunk["xPos"],
$chunk["zPos"],
$subChunks,

View File

@ -188,7 +188,6 @@ class McRegion extends BaseLevelProvider{
}
$result = new Chunk(
$this,
$chunk["xPos"],
$chunk["zPos"],
$subChunks,
@ -294,9 +293,6 @@ class McRegion extends BaseLevelProvider{
}
public function setChunk(int $chunkX, int $chunkZ, Chunk $chunk){
$chunk->setProvider($this);
self::getRegionIndex($chunkX, $chunkZ, $regionX, $regionZ);
$this->loadRegion($regionX, $regionZ);
@ -354,7 +350,7 @@ class McRegion extends BaseLevelProvider{
public function unloadChunk(int $chunkX, int $chunkZ, bool $safe = true) : bool{
$chunk = $this->chunks[$index = Level::chunkHash($chunkX, $chunkZ)] ?? null;
if($chunk instanceof Chunk and $chunk->unload(false, $safe)){
if($chunk instanceof Chunk and $chunk->unload($safe)){
unset($this->chunks[$index]);
return true;
}
@ -422,7 +418,7 @@ class McRegion extends BaseLevelProvider{
* @return Chunk
*/
public function getEmptyChunk(int $chunkX, int $chunkZ){
return Chunk::getEmptyChunk($chunkX, $chunkZ, $this);
return Chunk::getEmptyChunk($chunkX, $chunkZ);
}
/**

View File

@ -129,7 +129,6 @@ class PMAnvil extends Anvil{
}
$result = new Chunk(
$this,
$chunk["xPos"],
$chunk["zPos"],
$subChunks,