mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-05 17:36:12 +00:00
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:
@ -76,16 +76,16 @@ abstract class Tile extends Position{
|
||||
|
||||
/**
|
||||
* @param string $type
|
||||
* @param Chunk $chunk
|
||||
* @param Level $level
|
||||
* @param CompoundTag $nbt
|
||||
* @param $args
|
||||
*
|
||||
* @return Tile
|
||||
*/
|
||||
public static function createTile($type, Chunk $chunk, CompoundTag $nbt, ...$args){
|
||||
public static function createTile($type, Level $level, CompoundTag $nbt, ...$args){
|
||||
if(isset(self::$knownTiles[$type])){
|
||||
$class = self::$knownTiles[$type];
|
||||
return new $class($chunk, $nbt, ...$args);
|
||||
return new $class($level, $nbt, ...$args);
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -116,15 +116,15 @@ abstract class Tile extends Position{
|
||||
return self::$shortNames[static::class];
|
||||
}
|
||||
|
||||
public function __construct(Chunk $chunk, CompoundTag $nbt){
|
||||
assert($chunk !== null and $chunk->getProvider() !== null);
|
||||
|
||||
public function __construct(Level $level, CompoundTag $nbt){
|
||||
$this->timings = Timings::getTileEntityTimings($this);
|
||||
|
||||
$this->server = $chunk->getProvider()->getLevel()->getServer();
|
||||
$this->chunk = $chunk;
|
||||
$this->setLevel($chunk->getProvider()->getLevel());
|
||||
$this->namedtag = $nbt;
|
||||
$this->server = $level->getServer();
|
||||
$this->setLevel($level);
|
||||
$this->chunk = $level->getChunk($this->namedtag["x"] >> 4, $this->namedtag["z"] >> 4, false);
|
||||
assert($this->chunk !== null);
|
||||
|
||||
$this->name = "";
|
||||
$this->lastUpdate = microtime(true);
|
||||
$this->id = Tile::$tileCount++;
|
||||
|
Reference in New Issue
Block a user