mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
Updated Position to use Weak / strong references for Level objects
This commit is contained in:
@ -35,7 +35,7 @@ class Potato extends Flowable{
|
||||
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
|
||||
$down = $this->getSide(0);
|
||||
if($down->getID() === self::FARMLAND){
|
||||
$this->level->setBlock($block, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($block, $this, true, false, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -46,7 +46,7 @@ class Potato extends Flowable{
|
||||
public function onActivate(Item $item, Player $player = null){
|
||||
if($item->getID() === Item::DYE and $item->getMetadata() === 0x0F){ //Bonemeal
|
||||
$this->meta = 0x07;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($this, $this, true, false, true);
|
||||
if(($player->gamemode & 0x01) === 0){
|
||||
$item->count--;
|
||||
}
|
||||
@ -62,7 +62,7 @@ class Potato extends Flowable{
|
||||
if($this->getSide(0)->isTransparent === true){ //Replace with common break method
|
||||
//TODO
|
||||
//Server::getInstance()->api->entity->drop($this, Item::get(POTATO, 0, 1));
|
||||
$this->level->setBlock($this, new Air(), false, false, true);
|
||||
$this->getLevel()->setBlock($this, new Air(), false, false, true);
|
||||
|
||||
return Level::BLOCK_UPDATE_NORMAL;
|
||||
}
|
||||
@ -70,7 +70,7 @@ class Potato extends Flowable{
|
||||
if(mt_rand(0, 2) == 1){
|
||||
if($this->meta < 0x07){
|
||||
++$this->meta;
|
||||
$this->level->setBlock($this, $this, true, false, true);
|
||||
$this->getLevel()->setBlock($this, $this, true, false, true);
|
||||
|
||||
return Level::BLOCK_UPDATE_RANDOM;
|
||||
}
|
||||
|
Reference in New Issue
Block a user