Cleaned up shared rotation code, fixed quartz pillar rotation, added bone blocks

This commit is contained in:
Dylan K. Taylor
2017-08-25 13:06:16 +01:00
parent 8ce833bf74
commit 76e213ae73
5 changed files with 124 additions and 18 deletions

View File

@ -23,15 +23,17 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\PillarRotationHelper;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\math\Vector3;
use pocketmine\Player;
class Quartz extends Solid{
const QUARTZ_NORMAL = 0;
const QUARTZ_CHISELED = 1;
const QUARTZ_PILLAR = 2;
const QUARTZ_PILLAR2 = 3;
protected $id = self::QUARTZ_BLOCK;
@ -47,10 +49,16 @@ class Quartz extends Solid{
static $names = [
self::QUARTZ_NORMAL => "Quartz Block",
self::QUARTZ_CHISELED => "Chiseled Quartz Block",
self::QUARTZ_PILLAR => "Quartz Pillar",
self::QUARTZ_PILLAR2 => "Quartz Pillar"
self::QUARTZ_PILLAR => "Quartz Pillar"
];
return $names[$this->meta & 0x03];
return $names[$this->meta & 0x03] ?? "Unknown";
}
public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{
if($this->meta !== self::QUARTZ_NORMAL){
$this->meta = PillarRotationHelper::getMetaFromFace($this->meta, $face);
}
return $this->getLevel()->setBlock($block, $this, true, true);
}
public function getToolType() : int{