mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-25 12:54:03 +00:00
Block: Rename getItem() to asItem()
this has clearer meaning and is less likely to collide with other things.
This commit is contained in:
parent
ff35736bf9
commit
0bd1c1529e
@ -202,7 +202,7 @@ class Bed extends Transparent{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getItem() : Item{
|
||||
public function asItem() : Item{
|
||||
return ItemFactory::get($this->idInfo->getItemId(), $this->color->getMagicNumber());
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ class Block extends Position implements BlockIds, Metadatable{
|
||||
return $this->idInfo->getBlockId();
|
||||
}
|
||||
|
||||
public function getItem() : Item{
|
||||
public function asItem() : Item{
|
||||
return ItemFactory::get($this->idInfo->getItemId(), $this->idInfo->getVariant());
|
||||
}
|
||||
|
||||
@ -511,7 +511,7 @@ class Block extends Position implements BlockIds, Metadatable{
|
||||
* @return Item[]
|
||||
*/
|
||||
public function getDropsForCompatibleTool(Item $item) : array{
|
||||
return [$this->getItem()];
|
||||
return [$this->asItem()];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -522,7 +522,7 @@ class Block extends Position implements BlockIds, Metadatable{
|
||||
* @return Item[]
|
||||
*/
|
||||
public function getSilkTouchDrops(Item $item) : array{
|
||||
return [$this->getItem()];
|
||||
return [$this->asItem()];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -564,7 +564,7 @@ class Block extends Position implements BlockIds, Metadatable{
|
||||
* @return Item
|
||||
*/
|
||||
public function getPickedItem() : Item{
|
||||
return $this->getItem();
|
||||
return $this->asItem();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -82,7 +82,7 @@ class NetherWartPlant extends Flowable{
|
||||
|
||||
public function getDropsForCompatibleTool(Item $item) : array{
|
||||
return [
|
||||
$this->getItem()->setCount($this->age === 3 ? mt_rand(2, 4) : 1)
|
||||
$this->asItem()->setCount($this->age === 3 ? mt_rand(2, 4) : 1)
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ class Skull extends Flowable{
|
||||
return parent::place($item, $blockReplace, $blockClicked, $face, $clickVector, $player);
|
||||
}
|
||||
|
||||
public function getItem() : Item{
|
||||
public function asItem() : Item{
|
||||
return ItemFactory::get(Item::SKULL, $this->type);
|
||||
}
|
||||
|
||||
|
@ -136,6 +136,6 @@ abstract class Slab extends Transparent{
|
||||
}
|
||||
|
||||
public function getDropsForCompatibleTool(Item $item) : array{
|
||||
return [$this->getItem()->setCount($this->slabType === SlabType::DOUBLE() ? 2 : 1)];
|
||||
return [$this->asItem()->setCount($this->slabType === SlabType::DOUBLE() ? 2 : 1)];
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ abstract class Stem extends Crops{
|
||||
|
||||
public function getDropsForCompatibleTool(Item $item) : array{
|
||||
return [
|
||||
$this->getItem()->setCount(mt_rand(0, 2))
|
||||
$this->asItem()->setCount(mt_rand(0, 2))
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ class FallingBlock extends Entity{
|
||||
$block = $this->level->getBlock($pos);
|
||||
if($block->getId() > 0 and $block->isTransparent() and !$block->canBeReplaced()){
|
||||
//FIXME: anvils are supposed to destroy torches
|
||||
$this->getLevel()->dropItem($this, $this->block->getItem());
|
||||
$this->getLevel()->dropItem($this, $this->block->asItem());
|
||||
}else{
|
||||
$ev = new EntityBlockChangeEvent($this, $block, $blockTarget ?? $this->block);
|
||||
$ev->call();
|
||||
|
Loading…
x
Reference in New Issue
Block a user