Merge commit 'a2543ff80d2906bccda1a4e2fdbd9d8e7d147fb3'

This commit is contained in:
Dylan K. Taylor
2020-04-18 17:33:05 +01:00
76 changed files with 286 additions and 238 deletions

View File

@ -55,7 +55,7 @@ class BrewingStand extends Spawnable implements Container, Nameable{
parent::__construct($world, $pos);
$this->inventory = new BrewingStandInventory($this->pos);
$this->inventory->addChangeListeners(CallbackInventoryChangeListener::onAnyChange(function(Inventory $unused) : void{
$this->pos->getWorld()->scheduleDelayedBlockUpdate($this->pos, 1);
$this->pos->getWorldNonNull()->scheduleDelayedBlockUpdate($this->pos, 1);
}));
}

View File

@ -99,7 +99,7 @@ class Chest extends Spawnable implements Container, Nameable{
$this->inventory->removeAllViewers();
if($this->doubleInventory !== null){
if($this->isPaired() and $this->pos->getWorld()->isChunkLoaded($this->pairX >> 4, $this->pairZ >> 4)){
if($this->isPaired() and $this->pos->getWorldNonNull()->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->getWorld()->isInLoadedTerrain(new Vector3($this->pairX, $this->pos->y, $this->pairZ))){
if($this->isPaired() and !$this->pos->getWorldNonNull()->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->getWorld()->getTileAt($this->pairX, $this->pos->y, $this->pairZ);
$tile = $this->pos->getWorldNonNull()->getTileAt($this->pairX, $this->pos->y, $this->pairZ);
if($tile instanceof Chest){
return $tile;
}

View File

@ -60,7 +60,7 @@ class Furnace extends Spawnable implements Container, Nameable{
$this->inventory = new FurnaceInventory($this->pos);
$this->inventory->addChangeListeners(CallbackInventoryChangeListener::onAnyChange(
function(Inventory $unused) : void{
$this->pos->getWorld()->scheduleDelayedBlockUpdate($this->pos, 1);
$this->pos->getWorldNonNull()->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->getWorld()->setBlock($block->getPos(), $block);
$this->pos->getWorldNonNull()->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->getWorld()->getServer()->getCraftingManager()->matchFurnaceRecipe($raw);
$smelt = $this->pos->getWorldNonNull()->getServer()->getCraftingManager()->matchFurnaceRecipe($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->getWorld()->setBlock($block->getPos(), $block);
$this->pos->getWorldNonNull()->setBlock($block->getPos(), $block);
}
$this->remainingFuelTime = $this->cookTime = $this->maxFuelTime = 0;
}

View File

@ -95,7 +95,7 @@ abstract class Tile{
}
public function getBlock() : Block{
return $this->pos->getWorld()->getBlock($this->pos);
return $this->pos->getWorldNonNull()->getBlock($this->pos);
}
public function getPos() : Position{
@ -130,7 +130,7 @@ abstract class Tile{
$this->closed = true;
if($this->pos->isValid()){
$this->pos->getWorld()->removeTile($this);
$this->pos->getWorldNonNull()->removeTile($this);
$this->pos->setWorld(null);
}
}