mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 04:17:07 +00:00
Add PHPDoc Documentation to block types.
This commit is contained in:
parent
5eed43ddd0
commit
5dc52ad97d
@ -20,11 +20,21 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class DoorBlock extends TransparentBlock{
|
class DoorBlock extends TransparentBlock{
|
||||||
|
/**
|
||||||
|
* @param int $id
|
||||||
|
* @param int $meta
|
||||||
|
* @param string $name
|
||||||
|
*/
|
||||||
public function __construct($id, $meta = 0, $name = "Unknown"){
|
public function __construct($id, $meta = 0, $name = "Unknown"){
|
||||||
parent::__construct($id, $meta, $name);
|
parent::__construct($id, $meta, $name);
|
||||||
$this->isSolid = false;
|
$this->isSolid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $type
|
||||||
|
*
|
||||||
|
* @return bool|int
|
||||||
|
*/
|
||||||
public function onUpdate($type){
|
public function onUpdate($type){
|
||||||
if($type === BLOCK_UPDATE_NORMAL){
|
if($type === BLOCK_UPDATE_NORMAL){
|
||||||
if($this->getSide(0)->getID() === AIR){ //Replace with common break method
|
if($this->getSide(0)->getID() === AIR){ //Replace with common break method
|
||||||
@ -38,6 +48,18 @@ class DoorBlock extends TransparentBlock{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Item $item
|
||||||
|
* @param Player $player
|
||||||
|
* @param Block $block
|
||||||
|
* @param Block $target
|
||||||
|
* @param integer $face
|
||||||
|
* @param integer $fx
|
||||||
|
* @param integer $fy
|
||||||
|
* @param integer $fz
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||||
if($face === 1){
|
if($face === 1){
|
||||||
$blockUp = $this->getSide(1);
|
$blockUp = $this->getSide(1);
|
||||||
@ -67,6 +89,12 @@ class DoorBlock extends TransparentBlock{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Item $item
|
||||||
|
* @param Player $player
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
public function onBreak(Item $item, Player $player){
|
public function onBreak(Item $item, Player $player){
|
||||||
if(($this->meta & 0x08) === 0x08){
|
if(($this->meta & 0x08) === 0x08){
|
||||||
$down = $this->getSide(0);
|
$down = $this->getSide(0);
|
||||||
@ -83,6 +111,12 @@ class DoorBlock extends TransparentBlock{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Item $item
|
||||||
|
* @param Player $player
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
public function onActivate(Item $item, Player $player){
|
public function onActivate(Item $item, Player $player){
|
||||||
if(($this->meta & 0x08) === 0x08){ //Top
|
if(($this->meta & 0x08) === 0x08){ //Top
|
||||||
$down = $this->getSide(0);
|
$down = $this->getSide(0);
|
||||||
|
@ -20,11 +20,28 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class FallableBlock extends SolidBlock{
|
class FallableBlock extends SolidBlock{
|
||||||
|
/**
|
||||||
|
* @param int $id
|
||||||
|
* @param int $meta
|
||||||
|
* @param string $name
|
||||||
|
*/
|
||||||
public function __construct($id, $meta = 0, $name = "Unknown"){
|
public function __construct($id, $meta = 0, $name = "Unknown"){
|
||||||
parent::__construct($id, $meta, $name);
|
parent::__construct($id, $meta, $name);
|
||||||
$this->hasPhysics = true;
|
$this->hasPhysics = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Item $item
|
||||||
|
* @param Player $player
|
||||||
|
* @param Block $block
|
||||||
|
* @param Block $target
|
||||||
|
* @param int $face
|
||||||
|
* @param int $fx
|
||||||
|
* @param int $fy
|
||||||
|
* @param int $fz
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||||
$ret = $this->level->setBlock($this, $this, true, false, true);
|
$ret = $this->level->setBlock($this, $this, true, false, true);
|
||||||
ServerAPI::request()->api->block->blockUpdate(clone $this, BLOCK_UPDATE_NORMAL);
|
ServerAPI::request()->api->block->blockUpdate(clone $this, BLOCK_UPDATE_NORMAL);
|
||||||
|
@ -20,6 +20,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class FlowableBlock extends TransparentBlock{
|
class FlowableBlock extends TransparentBlock{
|
||||||
|
/**
|
||||||
|
* @param int $id
|
||||||
|
* @param int $meta
|
||||||
|
* @param string $name
|
||||||
|
*/
|
||||||
public function __construct($id, $meta = 0, $name = "Unknown"){
|
public function __construct($id, $meta = 0, $name = "Unknown"){
|
||||||
parent::__construct($id, $meta, $name);
|
parent::__construct($id, $meta, $name);
|
||||||
$this->isFlowable = true;
|
$this->isFlowable = true;
|
||||||
|
@ -21,21 +21,56 @@
|
|||||||
|
|
||||||
|
|
||||||
class GenericBlock extends Block{
|
class GenericBlock extends Block{
|
||||||
|
/**
|
||||||
|
* @param int $id
|
||||||
|
* @param int $meta
|
||||||
|
* @param string $name
|
||||||
|
*/
|
||||||
public function __construct($id, $meta = 0, $name = "Unknown"){
|
public function __construct($id, $meta = 0, $name = "Unknown"){
|
||||||
parent::__construct($id, $meta, $name);
|
parent::__construct($id, $meta, $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Item $item
|
||||||
|
* @param Player $player
|
||||||
|
* @param Block $block
|
||||||
|
* @param Block $target
|
||||||
|
* @param integer $face
|
||||||
|
* @param integer $fx
|
||||||
|
* @param integer $fy
|
||||||
|
* @param integer $fz
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||||
return $this->level->setBlock($this, $this, true, false, true);
|
return $this->level->setBlock($this, $this, true, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Item $item
|
||||||
|
* @param Player $player
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
public function isBreakable(Item $item, Player $player){
|
public function isBreakable(Item $item, Player $player){
|
||||||
return ($this->breakable);
|
return ($this->breakable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Item $item
|
||||||
|
* @param Player $player
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
public function onBreak(Item $item, Player $player){
|
public function onBreak(Item $item, Player $player){
|
||||||
return $this->level->setBlock($this, new AirBlock(), true, false, true);
|
return $this->level->setBlock($this, new AirBlock(), true, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param integer $type
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
public function onUpdate($type){
|
public function onUpdate($type){
|
||||||
if($this->hasPhysics === true and $type === BLOCK_UPDATE_NORMAL){
|
if($this->hasPhysics === true and $type === BLOCK_UPDATE_NORMAL){
|
||||||
$down = $this->getSide(0);
|
$down = $this->getSide(0);
|
||||||
@ -57,6 +92,12 @@ class GenericBlock extends Block{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Item $item
|
||||||
|
* @param Player $player
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
public function onActivate(Item $item, Player $player){
|
public function onActivate(Item $item, Player $player){
|
||||||
return $this->isActivable;
|
return $this->isActivable;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class LiquidBlock extends TransparentBlock{
|
class LiquidBlock extends TransparentBlock{
|
||||||
|
/**
|
||||||
|
* @param int $id
|
||||||
|
* @param int $meta
|
||||||
|
* @param string $name
|
||||||
|
*/
|
||||||
public function __construct($id, $meta = 0, $name = "Unknown"){
|
public function __construct($id, $meta = 0, $name = "Unknown"){
|
||||||
parent::__construct($id, $meta, $name);
|
parent::__construct($id, $meta, $name);
|
||||||
$this->isLiquid = true;
|
$this->isLiquid = true;
|
||||||
|
@ -20,6 +20,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class SolidBlock extends GenericBlock{
|
class SolidBlock extends GenericBlock{
|
||||||
|
/**
|
||||||
|
* @param int $id
|
||||||
|
* @param int $meta
|
||||||
|
* @param string $name
|
||||||
|
*/
|
||||||
public function __construct($id, $meta = 0, $name = "Unknown"){
|
public function __construct($id, $meta = 0, $name = "Unknown"){
|
||||||
parent::__construct($id, $meta, $name);
|
parent::__construct($id, $meta, $name);
|
||||||
$this->isSolid = true;
|
$this->isSolid = true;
|
||||||
|
@ -20,6 +20,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class StairBlock extends TransparentBlock{
|
class StairBlock extends TransparentBlock{
|
||||||
|
/**
|
||||||
|
* @param int $id
|
||||||
|
* @param int $meta
|
||||||
|
* @param string $name
|
||||||
|
*/
|
||||||
public function __construct($id, $meta = 0, $name = "Unknown"){
|
public function __construct($id, $meta = 0, $name = "Unknown"){
|
||||||
parent::__construct($id, $meta, $name);
|
parent::__construct($id, $meta, $name);
|
||||||
if(($this->meta & 0x04) === 0x04){
|
if(($this->meta & 0x04) === 0x04){
|
||||||
@ -30,6 +35,18 @@ class StairBlock extends TransparentBlock{
|
|||||||
$this->hardness = 30;
|
$this->hardness = 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Item $item
|
||||||
|
* @param Player $player
|
||||||
|
* @param Block $block
|
||||||
|
* @param Block $target
|
||||||
|
* @param int $face
|
||||||
|
* @param int $fx
|
||||||
|
* @param int $fy
|
||||||
|
* @param int $fz
|
||||||
|
*
|
||||||
|
* @return bool|mixed
|
||||||
|
*/
|
||||||
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){
|
||||||
$faces = array(
|
$faces = array(
|
||||||
0 => 0,
|
0 => 0,
|
||||||
@ -45,6 +62,12 @@ class StairBlock extends TransparentBlock{
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Item $item
|
||||||
|
* @param Player $player
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function getDrops(Item $item, Player $player){
|
public function getDrops(Item $item, Player $player){
|
||||||
if($item->isPickaxe() >= 1){
|
if($item->isPickaxe() >= 1){
|
||||||
return array(
|
return array(
|
||||||
|
@ -20,6 +20,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
class TransparentBlock extends GenericBlock{
|
class TransparentBlock extends GenericBlock{
|
||||||
|
/**
|
||||||
|
* @param int $id
|
||||||
|
* @param int $meta
|
||||||
|
* @param string $name
|
||||||
|
*/
|
||||||
public function __construct($id, $meta = 0, $name = "Unknown"){
|
public function __construct($id, $meta = 0, $name = "Unknown"){
|
||||||
parent::__construct($id, $meta, $name);
|
parent::__construct($id, $meta, $name);
|
||||||
$this->isActivable = false;
|
$this->isActivable = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user