Inheritance: extends pocketmine\block\Generic
Ejemplo n.º 1
0
 public function __construct($meta = 0)
 {
     parent::__construct(self::STAINED_CLAY, $meta, "Stained Clay");
     $names = [0 => "White Stained Clay", 1 => "Orange Stained Clay", 2 => "Magenta Stained Clay", 3 => "Light Blue Stained Clay", 4 => "Yellow Stained Clay", 5 => "Lime Stained Clay", 6 => "Pink Stained Clay", 7 => "Gray Stained Clay", 8 => "Light Gray Stained Clay", 9 => "Cyan Stained Clay", 10 => "Purple Stained Clay", 11 => "Blue Stained Clay", 12 => "Brown Stained Clay", 13 => "Green Stained Clay", 14 => "Red Stained Clay", 15 => "Black Stained Clay"];
     $this->name = $names[$this->meta];
     $this->hardness = 30;
 }
Ejemplo n.º 2
0
 public function __construct($meta = 0)
 {
     parent::__construct(self::DOUBLE_SLAB, $meta, "Double Slab");
     $names = [0 => "Stone", 1 => "Sandstone", 2 => "Wooden", 3 => "Cobblestone", 4 => "Brick", 5 => "Stone Brick", 6 => "Quartz", 7 => ""];
     $this->name = "Double " . $names[$this->meta & 0x7] . " Slab";
     $this->hardness = 30;
 }
Ejemplo n.º 3
0
 public function __construct($meta = 0)
 {
     parent::__construct(self::STONE_BRICKS, $meta, "Stone Bricks");
     $names = [0 => "Stone Bricks", 1 => "Mossy Stone Bricks", 2 => "Cracked Stone Bricks", 3 => "Chiseled Stone Bricks"];
     $this->name = $names[$this->meta & 0x3];
     $this->hardness = 30;
 }
Ejemplo n.º 4
0
 public function __construct($meta = 0)
 {
     parent::__construct(self::SANDSTONE, $meta, "Sandstone");
     $names = [0 => "Sandstone", 1 => "Chiseled Sandstone", 2 => "Smooth Sandstone"];
     $this->name = $names[$this->meta & 0x3];
     $this->hardness = 4;
 }
Ejemplo n.º 5
0
 public function onBreak(Item $item)
 {
     if ($this->getRandomExperience($item) > 0) {
         Entity::createEntity("ExperienceOrb", $this->level->getChunk($this->x >> 4, $this->z >> 4), new Compound("", ["Pos" => new Enum("Pos", [new Double("", $this->x), new Double("", $this->y), new Double("", $this->z)]), "Motion" => new Enum("Motion", [new Double("", 0), new Double("", 0), new Double("", 0)]), "Rotation" => new Enum("Rotation", [new Float("", 0), new Float("", 0)])]))->spawnToAll();
     }
     return parent::onBreak($item);
 }
Ejemplo n.º 6
0
 public function __construct($meta = 0)
 {
     parent::__construct(self::WOOD, $meta, "Wood");
     $names = [self::OAK => "Oak Wood", self::SPRUCE => "Spruce Wood", self::BIRCH => "Birch Wood", self::JUNGLE => "Jungle Wood"];
     $this->name = $names[$this->meta & 0x3];
     $this->hardness = 10;
 }
Ejemplo n.º 7
0
 public function __construct($meta = 0)
 {
     parent::__construct(self::DOUBLE_WOOD_SLAB, $meta, "Double Wooden Slab");
     $names = [0 => "Oak", 1 => "Spruce", 2 => "Birch", 3 => "Jungle", 4 => "Acacia", 5 => "Dark Oak"];
     $this->name = "Double " . $names[$this->meta & 0x7] . " Wooden Slab";
     $this->hardness = 15;
 }
Ejemplo n.º 8
0
 public function onUpdate($type)
 {
     parent::onUpdate($type);
     $faces = [1 => 0, 2 => 3, 3 => 2, 4 => 5, 5 => 4];
     if ($type === Level::BLOCK_UPDATE_NORMAL) {
         if ($this->getSide($faces[$this->meta])->getId() === self::AIR) {
             $this->getLevel()->useBreakOn($this);
             return Level::BLOCK_UPDATE_NORMAL;
         }
     }
     return false;
 }
Ejemplo n.º 9
0
 public function onBreak(Item $item)
 {
     parent::onBreak($item);
     if ($this->getLevel()->getServer()->netherEnabled) {
         for ($i = 0; $i <= 6; $i++) {
             if ($i == 6) {
                 return;
             } elseif ($this->getLevel()->getBlock($this->getSide($i))->getId() == 90) {
                 $side = $i;
                 break;
             }
         }
         $block = $this->getLevel()->getBlock($this->getSide($i));
         if ($this->getLevel()->getBlock($block->add(-1, 0, 0))->getId() == 90 or $this->getLevel()->getBlock($block->add(1, 0, 0))->getId() == 90) {
             //x方向
             for ($x = $block->getX(); $this->getLevel()->getBlock(new Vector3($x, $block->getY(), $block->getZ()))->getId() == 90; $x++) {
                 for ($y = $block->getY(); $this->getLevel()->getBlock(new Vector3($x, $y, $block->getZ()))->getId() == 90; $y++) {
                     $this->getLevel()->setBlock(new Vector3($x, $y, $block->getZ()), new Block(0, 0));
                 }
                 for ($y = $block->getY() - 1; $this->getLevel()->getBlock(new Vector3($x, $y, $block->getZ()))->getId() == 90; $y--) {
                     $this->getLevel()->setBlock(new Vector3($x, $y, $block->getZ()), new Block(0, 0));
                 }
             }
             for ($x = $block->getX() - 1; $this->getLevel()->getBlock(new Vector3($x, $block->getY(), $block->getZ()))->getId() == 90; $x--) {
                 for ($y = $block->getY(); $this->getLevel()->getBlock(new Vector3($x, $y, $block->getZ()))->getId() == 90; $y++) {
                     $this->getLevel()->setBlock(new Vector3($x, $y, $block->getZ()), new Block(0, 0));
                 }
                 for ($y = $block->getY() - 1; $this->getLevel()->getBlock(new Vector3($x, $y, $block->getZ()))->getId() == 90; $y--) {
                     $this->getLevel()->setBlock(new Vector3($x, $y, $block->getZ()), new Block(0, 0));
                 }
             }
         } else {
             //z方向
             for ($z = $block->getZ(); $this->getLevel()->getBlock(new Vector3($block->getX(), $block->getY(), $z))->getId() == 90; $z++) {
                 for ($y = $block->getY(); $this->getLevel()->getBlock(new Vector3($block->getX(), $y, $z))->getId() == 90; $y++) {
                     $this->getLevel()->setBlock(new Vector3($block->getX(), $y, $z), new Block(0, 0));
                 }
                 for ($y = $block->getY() - 1; $this->getLevel()->getBlock(new Vector3($block->getX(), $y, $z))->getId() == 90; $y--) {
                     $this->getLevel()->setBlock(new Vector3($block->getX(), $y, $z), new Block(0, 0));
                 }
             }
             for ($z = $block->getZ() - 1; $this->getLevel()->getBlock(new Vector3($block->getX(), $block->getY(), $z))->getId() == 90; $z--) {
                 for ($y = $block->getY(); $this->getLevel()->getBlock(new Vector3($block->getX(), $y, $z))->getId() == 90; $y++) {
                     $this->getLevel()->setBlock(new Vector3($block->getX(), $y, $z), new Block(0, 0));
                 }
                 for ($y = $block->getY() - 1; $this->getLevel()->getBlock(new Vector3($block->getX(), $y, $z))->getId() == 90; $y--) {
                     $this->getLevel()->setBlock(new Vector3($block->getX(), $y, $z), new Block(0, 0));
                 }
             }
         }
     }
 }
Ejemplo n.º 10
0
 public function onBreak(Item $item)
 {
     parent::onBreak($item);
     if ($this->getLevel()->getServer()->netherEnabled) {
         for ($i = 0; $i <= 6; $i++) {
             if ($this->getSide($i)->getId() == self::PORTAL) {
                 break;
             }
             if ($i == 6) {
                 return;
             }
         }
         $block = $this->getSide($i);
         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());
                 }
             }
         }
     }
 }
Ejemplo n.º 11
0
 public function __construct()
 {
     parent::__construct(self::MONSTER_SPAWNER, 0, "Monster Spawner");
     $this->hardness = 25;
 }
Ejemplo n.º 12
0
 public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null)
 {
     $this->downSideId = $this->getSide(0)->getId();
     return parent::place($item, $block, $target, $face, $fx, $fy, $fz, $player);
 }
Ejemplo n.º 13
0
 public function __construct()
 {
     parent::__construct(self::DIAMOND_BLOCK, 0, "Diamond Block");
     $this->hardness = 30;
 }
Ejemplo n.º 14
0
 public function __construct()
 {
     parent::__construct(self::MYCELIUM, 0, "Mycelium");
     $this->hardness = 2.5;
 }
Ejemplo n.º 15
0
 public function __construct()
 {
     parent::__construct(self::GOLD_BLOCK, 0, "Gold Block");
     $this->hardness = 30;
 }
Ejemplo n.º 16
0
 public function __construct()
 {
     parent::__construct(self::IRON_BLOCK, 0, "Iron Block");
     $this->hardness = 30;
 }
Ejemplo n.º 17
0
 public function __construct()
 {
     parent::__construct(self::NETHERRACK, 0, "Netherrack");
     $this->hardness = 2;
 }
Ejemplo n.º 18
0
 public function __construct()
 {
     parent::__construct(self::HARDENED_CLAY, 0, "Hardened Clay");
     $this->hardness = 30;
 }
Ejemplo n.º 19
0
 public function __construct()
 {
     parent::__construct(self::PUMPKIN, "Pumpkin");
     $this->hardness = 5;
 }
Ejemplo n.º 20
0
 public function __construct($meta = 0)
 {
     parent::__construct(self::MOSS_STONE, $meta, "Moss Stone");
     $this->hardness = 30;
 }
Ejemplo n.º 21
0
 public function __construct($meta = 0)
 {
     parent::__construct(self::FARMLAND, $meta, "Farmland");
     $this->hardness = 3;
 }
Ejemplo n.º 22
0
 public function __construct($meta = 0)
 {
     parent::__construct(self::END_PORTAL, $meta, "End Portal");
     $this->hardness = 18000000;
 }
Ejemplo n.º 23
0
 public function __construct()
 {
     parent::__construct(self::DIAMOND_ORE, 0, "Diamond Ore");
     $this->hardness = 15;
 }
Ejemplo n.º 24
0
 public function __construct()
 {
     parent::__construct(self::END_STONE, 0, "End Stone");
     $this->hardness = 45;
 }
Ejemplo n.º 25
0
 public function __construct()
 {
     parent::__construct(self::REDSTONE_ORE, 0, "Redstone Ore");
     $this->hardness = 15;
 }
Ejemplo n.º 26
0
 public function __construct()
 {
     parent::__construct(self::GLOWING_REDSTONE_ORE, 0, "Glowing Redstone Ore");
     $this->hardness = 15;
 }
Ejemplo n.º 27
0
 public function __construct()
 {
     parent::__construct(self::CLAY_BLOCK, 0, "Clay Block");
     $this->hardness = 3;
 }
Ejemplo n.º 28
0
 public function __construct()
 {
     parent::__construct(self::NETHER_BRICKS, 0, "Nether Bricks");
     $this->hardness = 30;
 }
Ejemplo n.º 29
0
 public function __construct()
 {
     parent::__construct(self::BEDROCK, 0, "Bedrock");
     $this->breakable = false;
     $this->hardness = 18000000;
 }
Ejemplo n.º 30
0
 public function __construct()
 {
     parent::__construct(self::EMERALD_BLOCK, 0, "Emerald Block");
     $this->hardness = 30;
 }