mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
Position: rename getWorldNonNull() to getWorld(), remove original getWorld()
This commit is contained in:
@ -55,7 +55,7 @@ class BrewingStand extends Spawnable implements Container, Nameable{
|
||||
parent::__construct($world, $pos);
|
||||
$this->inventory = new BrewingStandInventory($this->pos);
|
||||
$this->inventory->getListeners()->add(CallbackInventoryListener::onAnyChange(function(Inventory $unused) : void{
|
||||
$this->pos->getWorldNonNull()->scheduleDelayedBlockUpdate($this->pos, 1);
|
||||
$this->pos->getWorld()->scheduleDelayedBlockUpdate($this->pos, 1);
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ class Chest extends Spawnable implements Container, Nameable{
|
||||
$this->inventory->removeAllViewers();
|
||||
|
||||
if($this->doubleInventory !== null){
|
||||
if($this->isPaired() and $this->pos->getWorldNonNull()->isChunkLoaded($this->pairX >> 4, $this->pairZ >> 4)){
|
||||
if($this->isPaired() and $this->pos->getWorld()->isChunkLoaded($this->pairX >> 4, $this->pairZ >> 4)){
|
||||
$this->doubleInventory->removeAllViewers();
|
||||
if(($pair = $this->getPair()) !== null){
|
||||
$pair->doubleInventory = null;
|
||||
@ -137,7 +137,7 @@ class Chest extends Spawnable implements Container, Nameable{
|
||||
}
|
||||
|
||||
protected function checkPairing() : void{
|
||||
if($this->isPaired() and !$this->pos->getWorldNonNull()->isInLoadedTerrain(new Vector3($this->pairX, $this->pos->y, $this->pairZ))){
|
||||
if($this->isPaired() and !$this->pos->getWorld()->isInLoadedTerrain(new Vector3($this->pairX, $this->pos->y, $this->pairZ))){
|
||||
//paired to a tile in an unloaded chunk
|
||||
$this->doubleInventory = null;
|
||||
|
||||
@ -173,7 +173,7 @@ class Chest extends Spawnable implements Container, Nameable{
|
||||
|
||||
public function getPair() : ?Chest{
|
||||
if($this->isPaired()){
|
||||
$tile = $this->pos->getWorldNonNull()->getTileAt($this->pairX, $this->pos->y, $this->pairZ);
|
||||
$tile = $this->pos->getWorld()->getTileAt($this->pairX, $this->pos->y, $this->pairZ);
|
||||
if($tile instanceof Chest){
|
||||
return $tile;
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ trait ContainerTrait{
|
||||
$pos = $this->getPos();
|
||||
|
||||
foreach($inv->getContents() as $k => $item){
|
||||
$pos->getWorldNonNull()->dropItem($pos->add(0.5, 0.5, 0.5), $item);
|
||||
$pos->getWorld()->dropItem($pos->add(0.5, 0.5, 0.5), $item);
|
||||
}
|
||||
$inv->clearAll();
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ class Furnace extends Spawnable implements Container, Nameable{
|
||||
$this->inventory = new FurnaceInventory($this->pos);
|
||||
$this->inventory->getListeners()->add(CallbackInventoryListener::onAnyChange(
|
||||
function(Inventory $unused) : void{
|
||||
$this->pos->getWorldNonNull()->scheduleDelayedBlockUpdate($this->pos, 1);
|
||||
$this->pos->getWorld()->scheduleDelayedBlockUpdate($this->pos, 1);
|
||||
})
|
||||
);
|
||||
}
|
||||
@ -129,7 +129,7 @@ class Furnace extends Spawnable implements Container, Nameable{
|
||||
$block = $this->getBlock();
|
||||
if($block instanceof BlockFurnace and !$block->isLit()){
|
||||
$block->setLit(true);
|
||||
$this->pos->getWorldNonNull()->setBlock($block->getPos(), $block);
|
||||
$this->pos->getWorld()->setBlock($block->getPos(), $block);
|
||||
}
|
||||
|
||||
if($this->remainingFuelTime > 0 and $ev->isBurning()){
|
||||
@ -155,7 +155,7 @@ class Furnace extends Spawnable implements Container, Nameable{
|
||||
$fuel = $this->inventory->getFuel();
|
||||
$raw = $this->inventory->getSmelting();
|
||||
$product = $this->inventory->getResult();
|
||||
$smelt = $this->pos->getWorldNonNull()->getServer()->getCraftingManager()->getFurnaceRecipeManager()->match($raw);
|
||||
$smelt = $this->pos->getWorld()->getServer()->getCraftingManager()->getFurnaceRecipeManager()->match($raw);
|
||||
$canSmelt = ($smelt instanceof FurnaceRecipe and $raw->getCount() > 0 and (($smelt->getResult()->equals($product) and $product->getCount() < $product->getMaxStackSize()) or $product->isNull()));
|
||||
|
||||
if($this->remainingFuelTime <= 0 and $canSmelt and $fuel->getFuelTime() > 0 and $fuel->getCount() > 0){
|
||||
@ -192,7 +192,7 @@ class Furnace extends Spawnable implements Container, Nameable{
|
||||
$block = $this->getBlock();
|
||||
if($block instanceof BlockFurnace and $block->isLit()){
|
||||
$block->setLit(false);
|
||||
$this->pos->getWorldNonNull()->setBlock($block->getPos(), $block);
|
||||
$this->pos->getWorld()->setBlock($block->getPos(), $block);
|
||||
}
|
||||
$this->remainingFuelTime = $this->cookTime = $this->maxFuelTime = 0;
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ abstract class Tile{
|
||||
}
|
||||
|
||||
public function getBlock() : Block{
|
||||
return $this->pos->getWorldNonNull()->getBlock($this->pos);
|
||||
return $this->pos->getWorld()->getBlock($this->pos);
|
||||
}
|
||||
|
||||
public function getPos() : Position{
|
||||
@ -130,7 +130,7 @@ abstract class Tile{
|
||||
$this->closed = true;
|
||||
|
||||
if($this->pos->isValid()){
|
||||
$this->pos->getWorldNonNull()->removeTile($this);
|
||||
$this->pos->getWorld()->removeTile($this);
|
||||
}
|
||||
$this->pos = null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user