mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 10:53:05 +00:00
Add runtime support for wall connections
this doesn't match the 1.16+ behaviour yet, but it at least recognizes walls that are already in the post-1.16 way and doesn't break them if not interacted with.
This commit is contained in:
@ -27,6 +27,7 @@ use pocketmine\block\utils\BellAttachmentType;
|
||||
use pocketmine\block\utils\CoralType;
|
||||
use pocketmine\block\utils\DyeColor;
|
||||
use pocketmine\block\utils\SlabType;
|
||||
use pocketmine\block\utils\WallConnectionType;
|
||||
use pocketmine\data\bedrock\block\BlockStateData;
|
||||
use pocketmine\data\bedrock\block\BlockStateDeserializeException;
|
||||
use pocketmine\data\bedrock\block\BlockStateNames;
|
||||
@ -296,6 +297,19 @@ final class BlockStateReader{
|
||||
};
|
||||
}
|
||||
|
||||
/** @throws BlockStateDeserializeException */
|
||||
public function readWallConnectionType(string $name) : ?WallConnectionType{
|
||||
return match($type = $this->readString($name)){
|
||||
//TODO: this looks a bit confusing due to use of EAST, but the values are the same for all connections
|
||||
//we need to find a better way to auto-generate the constant names when they are reused
|
||||
//for now, using these constants is better than nothing since it still gives static analysability
|
||||
StringValues::WALL_CONNECTION_TYPE_EAST_NONE => null,
|
||||
StringValues::WALL_CONNECTION_TYPE_EAST_SHORT => WallConnectionType::SHORT(),
|
||||
StringValues::WALL_CONNECTION_TYPE_EAST_TALL => WallConnectionType::TALL(),
|
||||
default => throw $this->badValueException($name, $type),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Explicitly mark a property as unused, so it doesn't get flagged as an error when debug mode is enabled
|
||||
*/
|
||||
|
Reference in New Issue
Block a user