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:
@ -25,8 +25,8 @@ namespace pocketmine\block;
|
||||
|
||||
use pocketmine\block\tile\Barrel as TileBarrel;
|
||||
use pocketmine\block\utils\AnyFacingTrait;
|
||||
use pocketmine\data\runtime\block\BlockDataReader;
|
||||
use pocketmine\data\runtime\block\BlockDataWriter;
|
||||
use pocketmine\data\runtime\RuntimeDataReader;
|
||||
use pocketmine\data\runtime\RuntimeDataWriter;
|
||||
use pocketmine\item\Item;
|
||||
use pocketmine\math\Facing;
|
||||
use pocketmine\math\Vector3;
|
||||
@ -41,12 +41,12 @@ class Barrel extends Opaque{
|
||||
|
||||
public function getRequiredStateDataBits() : int{ return 4; }
|
||||
|
||||
protected function decodeState(BlockDataReader $r) : void{
|
||||
protected function decodeState(RuntimeDataReader $r) : void{
|
||||
$this->setFacing($r->readFacing());
|
||||
$this->setOpen($r->readBool());
|
||||
}
|
||||
|
||||
protected function encodeState(BlockDataWriter $w) : void{
|
||||
protected function encodeState(RuntimeDataWriter $w) : void{
|
||||
$w->writeFacing($this->getFacing());
|
||||
$w->writeBool($this->isOpen());
|
||||
}
|
||||
|
Reference in New Issue
Block a user