Inheritance: extends pocketmine\block\Generic
Exemplo n.º 1
0
 public function __construct($meta = 0)
 {
     Transparent::__construct(self::LEAVES, $meta, "Leaves");
     $names = [self::ACACIA => "Acacia Leaves", self::DARK_OAK => "Dark Oak Leaves"];
     $this->name = $names[$this->meta & 0x3];
     $this->hardness = 1;
 }
Exemplo n.º 2
0
 public function __construct($meta = 0)
 {
     parent::__construct(self::SIGN_POST, $meta, "Sign Post");
     $this->isSolid = false;
     $this->isFullBlock = false;
     $this->hardness = 5;
 }
Exemplo n.º 3
0
 public function __construct($meta = 0)
 {
     parent::__construct(self::LADDER, $meta, "Ladder");
     $this->isSolid = false;
     $this->isFullBlock = false;
     $this->hardness = 2;
 }
Exemplo n.º 4
0
 public function __construct($meta = 0)
 {
     parent::__construct(self::LEAVES, $meta, "Leaves");
     $names = [self::OAK => "Oak Leaves", self::SPRUCE => "Spruce Leaves", self::BIRCH => "Birch Leaves", self::JUNGLE => "Jungle Leaves"];
     $this->name = $names[$this->meta & 0x3];
     $this->hardness = 1;
 }
Exemplo n.º 5
0
 public function __construct($type = 0)
 {
     parent::__construct(self::BED_BLOCK, $type, "Bed Block");
     $this->isActivable = true;
     $this->isFullBlock = false;
     $this->hardness = 1;
 }
Exemplo n.º 6
0
 public function __construct($meta = 0)
 {
     parent::__construct(self::CAKE_BLOCK, 0, "Cake Block");
     $this->isFullBlock = false;
     $this->isActivable = true;
     $this->meta = $meta & 0x7;
     $this->hardness = 2.5;
 }
Exemplo n.º 7
0
 public function getBreakTime(Item $item)
 {
     if ($item instanceof Air) {
         //Breaking by hand
         return 10;
     } else {
         // Other breaktimes are equal to woodfences.
         return parent::getBreakTime($item);
     }
 }
Exemplo n.º 8
0
 public function __construct($id, $meta = 0, $name = "Unknown")
 {
     parent::__construct($id, $meta, $name);
     if (($this->meta & 0x4) === 0x4) {
         $this->isFullBlock = true;
     } else {
         $this->isFullBlock = false;
     }
     $this->hardness = 30;
 }
Exemplo n.º 9
0
 public function __construct($meta = 0)
 {
     parent::__construct(self::FENCE_GATE, $meta, "Fence Gate");
     $this->isActivable = true;
     if (($this->meta & 0x4) === 0x4) {
         $this->isFullBlock = true;
     } else {
         $this->isFullBlock = false;
     }
     $this->hardness = 15;
 }
Exemplo n.º 10
0
 public function __construct($meta = 0)
 {
     parent::__construct(self::TRAPDOOR, $meta, "Trapdoor");
     $this->isActivable = true;
     if (($this->meta & 0x4) === 0x4) {
         $this->isFullBlock = false;
     } else {
         $this->isFullBlock = true;
     }
     $this->hardness = 15;
 }
Exemplo n.º 11
0
 public function __construct($meta = 0)
 {
     $meta &= 0x1;
     parent::__construct(self::STONE_WALL, $meta, "Cobblestone Wall");
     if ($meta === 1) {
         $this->name = "Mossy Cobblestone Wall";
     }
     $this->isFullBlock = false;
     $this->isSolid = false;
     $this->hardness = 30;
 }
Exemplo n.º 12
0
 public function __construct($meta = 0)
 {
     parent::__construct(self::WOOD_SLAB, $meta, "Wooden Slab");
     $names = [0 => "Oak", 1 => "Spruce", 2 => "Birch", 3 => "Jungle", 4 => "Acacia", 5 => "Dark Oak"];
     $this->name = (($this->meta & 0x8) === 0x8 ? "Upper " : "") . $names[$this->meta & 0x7] . " Wooden Slab";
     if (($this->meta & 0x8) === 0x8) {
         $this->isFullBlock = true;
     } else {
         $this->isFullBlock = false;
     }
     $this->hardness = 15;
 }
Exemplo n.º 13
0
 public function __construct($meta = 0)
 {
     parent::__construct(self::SLAB, $meta, "Slab");
     $names = [0 => "Stone", 1 => "Sandstone", 2 => "Wooden", 3 => "Cobblestone", 4 => "Brick", 5 => "Stone Brick", 6 => "Quartz", 7 => ""];
     $this->name = (($this->meta & 0x8) === 0x8 ? "Upper " : "") . $names[$this->meta & 0x7] . " Slab";
     if (($this->meta & 0x8) === 0x8) {
         $this->isFullBlock = true;
     } else {
         $this->isFullBlock = false;
     }
     $this->hardness = 30;
 }
Exemplo n.º 14
0
 public function __construct($meta = 0)
 {
     parent::__construct(self::CHEST, $meta, "Chest");
     $this->isActivable = true;
     $this->hardness = 15;
 }
Exemplo n.º 15
0
 public function __construct()
 {
     parent::__construct(self::GLASS, 0, "Glass");
     $this->hardness = 1.5;
 }
Exemplo n.º 16
0
 public function setPowerLevel($powerLevel)
 {
     if ($powerLevel > 0 and !$this->isOpen) {
         $this->switchOpen();
     } elseif ($powerLevel === 0 and $this->isOpen) {
         $this->switchOpen();
     }
     parent::setPowerLevel($powerLevel);
 }
Exemplo n.º 17
0
 public function onBreak(Item $item)
 {
     $sound = new EndermanTeleportSound($this);
     $this->getLevel()->addSound($sound);
     $particle = new PortalParticle($this);
     $this->getLevel()->addParticle($particle);
     $block = $this;
     //$this->getLevel()->setBlock($block, new Block(Block::PORTAL, 0));//在破坏处放置一个方块防止计算出错
     if ($this->getLevel()->getBlock($this->temporalVector->setComponents($block->x - 1, $block->y, $block->z))->getId() == Block::PORTAL or $this->getLevel()->getBlock($this->temporalVector->setComponents($block->x + 1, $block->y, $block->z))->getId() == Block::PORTAL) {
         //x方向
         for ($x = $block->x; $this->getLevel()->getBlock($this->temporalVector->setComponents($x, $block->y, $block->z))->getId() == Block::PORTAL; $x++) {
             for ($y = $block->y; $this->getLevel()->getBlock($this->temporalVector->setComponents($x, $y, $block->z))->getId() == Block::PORTAL; $y++) {
                 $this->getLevel()->setBlock($this->temporalVector->setComponents($x, $y, $block->z), new Air());
             }
             for ($y = $block->y - 1; $this->getLevel()->getBlock($this->temporalVector->setComponents($x, $y, $block->z))->getId() == Block::PORTAL; $y--) {
                 $this->getLevel()->setBlock($this->temporalVector->setComponents($x, $y, $block->z), new Air());
             }
         }
         for ($x = $block->x - 1; $this->getLevel()->getBlock($this->temporalVector->setComponents($x, $block->y, $block->z))->getId() == Block::PORTAL; $x--) {
             for ($y = $block->y; $this->getLevel()->getBlock($this->temporalVector->setComponents($x, $y, $block->z))->getId() == Block::PORTAL; $y++) {
                 $this->getLevel()->setBlock($this->temporalVector->setComponents($x, $y, $block->z), new Air());
             }
             for ($y = $block->y - 1; $this->getLevel()->getBlock($this->temporalVector->setComponents($x, $y, $block->z))->getId() == Block::PORTAL; $y--) {
                 $this->getLevel()->setBlock($this->temporalVector->setComponents($x, $y, $block->z), new Air());
             }
         }
     } else {
         //z方向
         for ($z = $block->z; $this->getLevel()->getBlock($this->temporalVector->setComponents($block->x, $block->y, $z))->getId() == Block::PORTAL; $z++) {
             for ($y = $block->y; $this->getLevel()->getBlock($this->temporalVector->setComponents($block->x, $y, $z))->getId() == Block::PORTAL; $y++) {
                 $this->getLevel()->setBlock($this->temporalVector->setComponents($block->x, $y, $z), new Air());
             }
             for ($y = $block->y - 1; $this->getLevel()->getBlock($this->temporalVector->setComponents($block->x, $y, $z))->getId() == Block::PORTAL; $y--) {
                 $this->getLevel()->setBlock($this->temporalVector->setComponents($block->x, $y, $z), new Air());
             }
         }
         for ($z = $block->z - 1; $this->getLevel()->getBlock($this->temporalVector->setComponents($block->x, $block->y, $z))->getId() == Block::PORTAL; $z--) {
             for ($y = $block->y; $this->getLevel()->getBlock($this->temporalVector->setComponents($block->x, $y, $z))->getId() == Block::PORTAL; $y++) {
                 $this->getLevel()->setBlock($this->temporalVector->setComponents($block->x, $y, $z), new Air());
             }
             for ($y = $block->y - 1; $this->getLevel()->getBlock($this->temporalVector->setComponents($block->x, $y, $z))->getId() == Block::PORTAL; $y--) {
                 $this->getLevel()->setBlock($this->temporalVector->setComponents($block->x, $y, $z), new Air());
             }
         }
     }
     parent::onBreak($item);
 }
Exemplo n.º 18
0
 public function __construct($id, $meta = 0, $name = "Unknown")
 {
     parent::__construct($id, $meta, $name);
     $this->isSolid = false;
 }
Exemplo n.º 19
0
 public function onBreak(Item $item)
 {
     $block = $this;
     if ($this->getLevel()->getBlock($this->temporalVector->setComponents($block->x - 1, $block->y, $block->z))->getId() == Block::PORTAL or $this->getLevel()->getBlock($this->temporalVector->setComponents($block->x + 1, $block->y, $block->z))->getId() == Block::PORTAL) {
         //x方向
         for ($x = $block->x; $this->getLevel()->getBlock($this->temporalVector->setComponents($x, $block->y, $block->z))->getId() == Block::PORTAL; $x++) {
             for ($y = $block->y; $this->getLevel()->getBlock($this->temporalVector->setComponents($x, $y, $block->z))->getId() == Block::PORTAL; $y++) {
                 $this->getLevel()->setBlock($this->temporalVector->setComponents($x, $y, $block->z), new Air());
             }
             for ($y = $block->y - 1; $this->getLevel()->getBlock($this->temporalVector->setComponents($x, $y, $block->z))->getId() == Block::PORTAL; $y--) {
                 $this->getLevel()->setBlock($this->temporalVector->setComponents($x, $y, $block->z), new Air());
             }
         }
         for ($x = $block->x - 1; $this->getLevel()->getBlock($this->temporalVector->setComponents($x, $block->y, $block->z))->getId() == Block::PORTAL; $x--) {
             for ($y = $block->y; $this->getLevel()->getBlock($this->temporalVector->setComponents($x, $y, $block->z))->getId() == Block::PORTAL; $y++) {
                 $this->getLevel()->setBlock($this->temporalVector->setComponents($x, $y, $block->z), new Air());
             }
             for ($y = $block->y - 1; $this->getLevel()->getBlock($this->temporalVector->setComponents($x, $y, $block->z))->getId() == Block::PORTAL; $y--) {
                 $this->getLevel()->setBlock($this->temporalVector->setComponents($x, $y, $block->z), new Air());
             }
         }
     } else {
         //z方向
         for ($z = $block->z; $this->getLevel()->getBlock($this->temporalVector->setComponents($block->x, $block->y, $z))->getId() == Block::PORTAL; $z++) {
             for ($y = $block->y; $this->getLevel()->getBlock($this->temporalVector->setComponents($block->x, $y, $z))->getId() == Block::PORTAL; $y++) {
                 $this->getLevel()->setBlock($this->temporalVector->setComponents($block->x, $y, $z), new Air());
             }
             for ($y = $block->y - 1; $this->getLevel()->getBlock($this->temporalVector->setComponents($block->x, $y, $z))->getId() == Block::PORTAL; $y--) {
                 $this->getLevel()->setBlock($this->temporalVector->setComponents($block->x, $y, $z), new Air());
             }
         }
         for ($z = $block->z - 1; $this->getLevel()->getBlock($this->temporalVector->setComponents($block->x, $block->y, $z))->getId() == Block::PORTAL; $z--) {
             for ($y = $block->y; $this->getLevel()->getBlock($this->temporalVector->setComponents($block->x, $y, $z))->getId() == Block::PORTAL; $y++) {
                 $this->getLevel()->setBlock($this->temporalVector->setComponents($block->x, $y, $z), new Air());
             }
             for ($y = $block->y - 1; $this->getLevel()->getBlock($this->temporalVector->setComponents($block->x, $y, $z))->getId() == Block::PORTAL; $y--) {
                 $this->getLevel()->setBlock($this->temporalVector->setComponents($block->x, $y, $z), new Air());
             }
         }
     }
     parent::onBreak($item);
 }
Exemplo n.º 20
0
 public function __construct()
 {
     parent::__construct(self::ICE, 0, "Ice");
     $this->hardness = 2.5;
 }
Exemplo n.º 21
0
 public function __construct()
 {
     parent::__construct(self::FENCE, 0, "Fence");
     $this->isFullBlock = false;
     $this->hardness = 15;
 }
Exemplo n.º 22
0
 public function __construct()
 {
     parent::__construct(self::MELON_BLOCK, 0, "Melon Block");
     $this->hardness = 5;
 }
Exemplo n.º 23
0
 public function __construct()
 {
     parent::__construct(self::GLOWSTONE_BLOCK, 0, "Glowstone");
     $this->hardness = 1.5;
 }