mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 19:02:59 +00:00
Offset integer ranges in runtime block data serialization
this is useful for stuff like snow layers where the range doesn't start at 0.
This commit is contained in:
@ -42,12 +42,12 @@ class SeaPickle extends Transparent{
|
||||
public function getRequiredStateDataBits() : int{ return 3; }
|
||||
|
||||
protected function decodeState(RuntimeDataReader $r) : void{
|
||||
$this->count = $r->readBoundedInt(2, self::MIN_COUNT - 1, self::MAX_COUNT - 1) + 1;
|
||||
$this->count = $r->readBoundedInt(2, self::MIN_COUNT, self::MAX_COUNT);
|
||||
$this->underwater = $r->readBool();
|
||||
}
|
||||
|
||||
protected function encodeState(RuntimeDataWriter $w) : void{
|
||||
$w->writeInt(2, $this->count - 1);
|
||||
$w->writeBoundedInt(2, self::MIN_COUNT, self::MAX_COUNT, $this->count);
|
||||
$w->writeBool($this->underwater);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user