mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 02:42:58 +00:00
Generalize runtime block data serialization
we want to reuse this code for item type data
This commit is contained in:
@ -27,10 +27,10 @@ use pocketmine\block\tile\Bell as TileBell;
|
||||
use pocketmine\block\utils\BellAttachmentType;
|
||||
use pocketmine\block\utils\HorizontalFacingTrait;
|
||||
use pocketmine\block\utils\SupportType;
|
||||
use pocketmine\data\runtime\block\BlockDataReader;
|
||||
use pocketmine\data\runtime\block\BlockDataReaderHelper;
|
||||
use pocketmine\data\runtime\block\BlockDataWriter;
|
||||
use pocketmine\data\runtime\block\BlockDataWriterHelper;
|
||||
use pocketmine\data\runtime\RuntimeDataReader;
|
||||
use pocketmine\data\runtime\RuntimeDataWriter;
|
||||
use pocketmine\data\runtime\RuntimeEnumDeserializer;
|
||||
use pocketmine\data\runtime\RuntimeEnumSerializer;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\math\AxisAlignedBB;
|
||||
use pocketmine\math\Facing;
|
||||
@ -51,13 +51,13 @@ final class Bell extends Transparent{
|
||||
|
||||
public function getRequiredStateDataBits() : int{ return 4; }
|
||||
|
||||
protected function decodeState(BlockDataReader $r) : void{
|
||||
$this->attachmentType = BlockDataReaderHelper::readBellAttachmentType($r);
|
||||
protected function decodeState(RuntimeDataReader $r) : void{
|
||||
$this->attachmentType = RuntimeEnumDeserializer::readBellAttachmentType($r);
|
||||
$this->facing = $r->readHorizontalFacing();
|
||||
}
|
||||
|
||||
protected function encodeState(BlockDataWriter $w) : void{
|
||||
BlockDataWriterHelper::writeBellAttachmentType($w, $this->attachmentType);
|
||||
protected function encodeState(RuntimeDataWriter $w) : void{
|
||||
RuntimeEnumSerializer::writeBellAttachmentType($w, $this->attachmentType);
|
||||
$w->writeHorizontalFacing($this->facing);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user