mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
Generalize runtime block data serialization
we want to reuse this code for item type data
This commit is contained in:
@ -23,8 +23,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\block;
|
||||
|
||||
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;
|
||||
|
||||
class UnknownBlock extends Transparent{
|
||||
@ -36,13 +36,13 @@ class UnknownBlock extends Transparent{
|
||||
$this->stateData = $stateData;
|
||||
}
|
||||
|
||||
protected function decodeType(BlockDataReader $r) : void{
|
||||
protected function decodeType(RuntimeDataReader $r) : void{
|
||||
//use type instead of state, so we don't lose any information like colour
|
||||
//this might be an improperly registered plugin block
|
||||
$this->stateData = $r->readInt(Block::INTERNAL_STATE_DATA_BITS);
|
||||
}
|
||||
|
||||
protected function encodeType(BlockDataWriter $w) : void{
|
||||
protected function encodeType(RuntimeDataWriter $w) : void{
|
||||
$w->writeInt(Block::INTERNAL_STATE_DATA_BITS, $this->stateData);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user