mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 10:22:56 +00:00
A giant hack to cut down code needed for runtime block serialization by 50%
this also avoids repeated information and inconsistencies.
This commit is contained in:
@ -37,12 +37,8 @@ final class Light extends Flowable{
|
||||
|
||||
public function getRequiredTypeDataBits() : int{ return 4; }
|
||||
|
||||
protected function decodeType(RuntimeDataReader $r) : void{
|
||||
$this->level = $r->readBoundedInt(4, self::MIN_LIGHT_LEVEL, self::MAX_LIGHT_LEVEL);
|
||||
}
|
||||
|
||||
protected function encodeType(RuntimeDataWriter $w) : void{
|
||||
$w->writeBoundedInt(4, self::MIN_LIGHT_LEVEL, self::MAX_LIGHT_LEVEL, $this->level);
|
||||
protected function describeType(RuntimeDataReader|RuntimeDataWriter $w) : void{
|
||||
$w->boundedInt(4, self::MIN_LIGHT_LEVEL, self::MAX_LIGHT_LEVEL, $this->level);
|
||||
}
|
||||
|
||||
public function getLightLevel() : int{ return $this->level; }
|
||||
|
Reference in New Issue
Block a user