[BC break] doors don't have a powered flag in Bedrock

This commit is contained in:
Dylan K. Taylor 2022-05-12 16:43:44 +01:00
parent d10d660a4d
commit 3ae9341c52
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
2 changed files with 1 additions and 6 deletions

View File

@ -98,7 +98,6 @@ final class BlockLegacyMetadata{
public const DOOR_FLAG_TOP = 0x08; public const DOOR_FLAG_TOP = 0x08;
public const DOOR_BOTTOM_FLAG_OPEN = 0x04; public const DOOR_BOTTOM_FLAG_OPEN = 0x04;
public const DOOR_TOP_FLAG_RIGHT = 0x01; public const DOOR_TOP_FLAG_RIGHT = 0x01;
public const DOOR_TOP_FLAG_POWERED = 0x02;
public const DOUBLE_PLANT_SUNFLOWER = 0; public const DOUBLE_PLANT_SUNFLOWER = 0;
public const DOUBLE_PLANT_LILAC = 1; public const DOUBLE_PLANT_LILAC = 1;

View File

@ -36,7 +36,6 @@ use pocketmine\world\sound\DoorSound;
class Door extends Transparent{ class Door extends Transparent{
use HorizontalFacingTrait; use HorizontalFacingTrait;
use PoweredByRedstoneTrait;
protected bool $top = false; protected bool $top = false;
protected bool $hingeRight = false; protected bool $hingeRight = false;
@ -45,8 +44,7 @@ class Door extends Transparent{
protected function writeStateToMeta() : int{ protected function writeStateToMeta() : int{
if($this->top){ if($this->top){
return BlockLegacyMetadata::DOOR_FLAG_TOP | return BlockLegacyMetadata::DOOR_FLAG_TOP |
($this->hingeRight ? BlockLegacyMetadata::DOOR_TOP_FLAG_RIGHT : 0) | ($this->hingeRight ? BlockLegacyMetadata::DOOR_TOP_FLAG_RIGHT : 0);
($this->powered ? BlockLegacyMetadata::DOOR_TOP_FLAG_POWERED : 0);
} }
return BlockDataSerializer::writeLegacyHorizontalFacing(Facing::rotateY($this->facing, true)) | ($this->open ? BlockLegacyMetadata::DOOR_BOTTOM_FLAG_OPEN : 0); return BlockDataSerializer::writeLegacyHorizontalFacing(Facing::rotateY($this->facing, true)) | ($this->open ? BlockLegacyMetadata::DOOR_BOTTOM_FLAG_OPEN : 0);
@ -56,7 +54,6 @@ class Door extends Transparent{
$this->top = ($stateMeta & BlockLegacyMetadata::DOOR_FLAG_TOP) !== 0; $this->top = ($stateMeta & BlockLegacyMetadata::DOOR_FLAG_TOP) !== 0;
if($this->top){ if($this->top){
$this->hingeRight = ($stateMeta & BlockLegacyMetadata::DOOR_TOP_FLAG_RIGHT) !== 0; $this->hingeRight = ($stateMeta & BlockLegacyMetadata::DOOR_TOP_FLAG_RIGHT) !== 0;
$this->powered = ($stateMeta & BlockLegacyMetadata::DOOR_TOP_FLAG_POWERED) !== 0;
}else{ }else{
$this->facing = Facing::rotateY(BlockDataSerializer::readLegacyHorizontalFacing($stateMeta & 0x03), false); $this->facing = Facing::rotateY(BlockDataSerializer::readLegacyHorizontalFacing($stateMeta & 0x03), false);
$this->open = ($stateMeta & BlockLegacyMetadata::DOOR_BOTTOM_FLAG_OPEN) !== 0; $this->open = ($stateMeta & BlockLegacyMetadata::DOOR_BOTTOM_FLAG_OPEN) !== 0;
@ -78,7 +75,6 @@ class Door extends Transparent{
$this->open = $other->open; $this->open = $other->open;
}else{ }else{
$this->hingeRight = $other->hingeRight; $this->hingeRight = $other->hingeRight;
$this->powered = $other->powered;
} }
} }
} }