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

@ -0,0 +1,69 @@
<?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\block\utils\PillarRotationHelper;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\math\Vector3;
use pocketmine\Player;
class BoneBlock extends Solid{
protected $id = Block::BONE_BLOCK;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName() : string{
return "Bone Block";
}
public function getHardness() : float{
return 2;
}
public function getToolType() : int{
return Tool::TYPE_PICKAXE;
}
public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{
$this->meta = PillarRotationHelper::getMetaFromFace($this->meta, $face);
return $this->getLevel()->setBlock($block, $this, true, true);
}
public function getVariantBitmask() : int{
return 0x03;
}
public function getDrops(Item $item) : array{
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return parent::getDrops($item); // TODO: Change the autogenerated stub
}
return [];
}
}