ItemFrame: add has-map bit

this makes the frame appear to cover the full block instead of the usual size.
This commit is contained in:
Dylan K. Taylor 2019-02-18 17:40:53 +00:00
parent 8f26c3a2d4
commit 6f7c63e2a8

View File

@ -38,21 +38,24 @@ class ItemFrame extends Flowable{
/** @var int */ /** @var int */
protected $facing = Facing::NORTH; protected $facing = Facing::NORTH;
/** @var bool */
protected $hasMap = false; //makes frame appear large if set
public function __construct(){ public function __construct(){
} }
protected function writeStateToMeta() : int{ protected function writeStateToMeta() : int{
return 5 - $this->facing; return (5 - $this->facing) | ($this->hasMap ? 0x04 : 0);
} }
public function readStateFromMeta(int $meta) : void{ public function readStateFromMeta(int $meta) : void{
$this->facing = BlockDataValidator::readHorizontalFacing(5 - $meta); $this->facing = BlockDataValidator::readHorizontalFacing(5 - ($meta & 0x03));
$this->hasMap = ($meta & 0x04) !== 0;
} }
public function getStateBitmask() : int{ public function getStateBitmask() : int{
return 0b11; return 0b111;
} }
protected function getTileClass() : ?string{ protected function getTileClass() : ?string{