Added some new blocks

This commit is contained in:
Dylan K. Taylor 2017-10-13 11:51:38 +01:00
parent 401e33dd85
commit eeea4fa06a
5 changed files with 170 additions and 11 deletions

View File

@ -268,12 +268,12 @@ class BlockFactory{
self::registerBlock(new GrassPath());
self::registerBlock(new ItemFrame());
//TODO: CHORUS_FLOWER
//TODO: PURPUR_BLOCK
self::registerBlock(new Purpur());
//TODO: PURPUR_STAIRS
self::registerBlock(new PurpurStairs());
//TODO: UNDYED_SHULKER_BOX
//TODO: END_BRICKS
self::registerBlock(new EndStoneBricks());
//TODO: FROSTED_ICE
self::registerBlock(new EndRod());
//TODO: END_GATEWAY

View File

@ -0,0 +1,57 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class EndStoneBricks extends Solid{
protected $id = self::END_BRICKS;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName() : string{
return "End Stone Bricks";
}
public function getHardness() : float{
return 0.8;
}
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return parent::getDrops($item);
}
return [];
}
}

View File

@ -0,0 +1,51 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
class Purpur extends Quartz{
protected $id = self::PURPUR_BLOCK;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName() : string{
static $names = [
self::NORMAL => "Purpur Block",
self::CHISELED => "Chiseled Purpur", //wtf?
self::PILLAR => "Purpur Pillar"
];
return $names[$this->getVariant()] ?? "Unknown";
}
public function getHardness() : float{
return 1.5;
}
public function getBlastResistance() : float{
return 30;
}
}

View File

@ -0,0 +1,51 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Tool;
class PurpurStairs extends Stair{
protected $id = self::PURPUR_STAIRS;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName() : string{
return "Purpur Stairs";
}
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function getHardness() : float{
return 1.5;
}
public function getBlastResistance() : float{
return 30;
}
}

View File

@ -31,9 +31,9 @@ use pocketmine\Player;
class Quartz extends Solid{
const QUARTZ_NORMAL = 0;
const QUARTZ_CHISELED = 1;
const QUARTZ_PILLAR = 2;
const NORMAL = 0;
const CHISELED = 1;
const PILLAR = 2;
protected $id = self::QUARTZ_BLOCK;
@ -47,15 +47,15 @@ class Quartz extends Solid{
public function getName() : string{
static $names = [
self::QUARTZ_NORMAL => "Quartz Block",
self::QUARTZ_CHISELED => "Chiseled Quartz Block",
self::QUARTZ_PILLAR => "Quartz Pillar"
self::NORMAL => "Quartz Block",
self::CHISELED => "Chiseled Quartz Block",
self::PILLAR => "Quartz Pillar"
];
return $names[$this->meta & 0x03] ?? "Unknown";
return $names[$this->getVariant()] ?? "Unknown";
}
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{
if($this->meta !== self::QUARTZ_NORMAL){
if($this->meta !== self::NORMAL){
$this->meta = PillarRotationHelper::getMetaFromFace($this->meta, $face);
}
return $this->getLevel()->setBlock($blockReplace, $this, true, true);