mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
Stem: implement facing property
fixes #5858 technically speaking, the sideways states for non-fully-grown stems shouldn't exist, but they do in Bedrock, and changing this code to split non-fully-grown stems from fully grown ones would likely require BC breaks. This was the minimum necessary to achieve the desired functionality.
This commit is contained in:
@ -236,9 +236,12 @@ final class BlockStateDeserializerHelper{
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public static function decodeStem(Stem $block, BlockStateReader $in) : Stem{
|
||||
//TODO: our stems don't support facings yet (facing_direction)
|
||||
$in->todo(BlockStateNames::FACING_DIRECTION);
|
||||
return self::decodeCrops($block, $in);
|
||||
//In PM, we use Facing::UP to indicate that the stem is not attached to a pumpkin/melon, since this makes the
|
||||
//most intuitive sense (the stem is pointing at the sky). However, Bedrock uses the DOWN state for this, which
|
||||
//is absurd, and I refuse to make our API similarly absurd.
|
||||
$facing = $in->readFacingWithoutUp();
|
||||
return self::decodeCrops($block, $in)
|
||||
->setFacing($facing === Facing::DOWN ? Facing::UP : $facing);
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
|
Reference in New Issue
Block a user