0
0
mirror of https://github.com/pmmp/PocketMine-MP.git synced 2025-03-14 07:47:35 +00:00

Fixed door facing

this was broken in 1.21.60 update.

should've known better to expect a blockstate upgrade to mean a
blockstate fix...
This commit is contained in:
Dylan K. Taylor
2025-02-24 01:04:05 +00:00
parent 1fed9f6cb5
commit 3df2bdb879
2 changed files with 4 additions and 2 deletions

@ -131,7 +131,8 @@ final class BlockStateDeserializerHelper{
//TODO: check if these need any special treatment to get the appropriate data to both halves of the door
return $block
->setTop($in->readBool(BlockStateNames::UPPER_BLOCK_BIT))
->setFacing($in->readCardinalHorizontalFacing())
//a door facing "east" is actually facing north - thanks mojang
->setFacing(Facing::rotateY($in->readCardinalHorizontalFacing(), clockwise: false))
->setHingeRight($in->readBool(BlockStateNames::DOOR_HINGE_BIT))
->setOpen($in->readBool(BlockStateNames::OPEN_BIT));
}

@ -100,7 +100,8 @@ final class BlockStateSerializerHelper{
public static function encodeDoor(Door $block, Writer $out) : Writer{
return $out
->writeBool(BlockStateNames::UPPER_BLOCK_BIT, $block->isTop())
->writeCardinalHorizontalFacing($block->getFacing())
//a door facing north is encoded as "east"
->writeCardinalHorizontalFacing(Facing::rotateY($block->getFacing(), clockwise: true))
->writeBool(BlockStateNames::DOOR_HINGE_BIT, $block->isHingeRight())
->writeBool(BlockStateNames::OPEN_BIT, $block->isOpen());
}