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

@ -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);