Use PillarRotationHelper for hay bales

This commit is contained in:
Dylan K. Taylor 2017-10-18 16:41:43 +01:00
parent 2c34648c3d
commit 15764543b4

View File

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\block\utils\PillarRotationHelper;
use pocketmine\item\Item;
use pocketmine\math\Vector3;
use pocketmine\Player;
@ -44,16 +45,7 @@ class HayBale extends Solid{
}
public function place(Item $item, Block $blockReplace, Block $blockClicked, int $face, Vector3 $facePos, Player $player = null) : bool{
$faces = [
0 => 0,
1 => 0,
2 => 0b1000,
3 => 0b1000,
4 => 0b0100,
5 => 0b0100
];
$this->meta = ($this->meta & 0x03) | $faces[$face];
$this->meta = PillarRotationHelper::getMetaFromFace($this->meta, $face);
$this->getLevel()->setBlock($blockReplace, $this, true, true);
return true;