mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-08 10:53:05 +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:
@ -48,13 +48,13 @@ class RedstoneRepeater extends Flowable{
|
||||
|
||||
protected function decodeState(RuntimeDataReader $r) : void{
|
||||
$this->facing = $r->readHorizontalFacing();
|
||||
$this->delay = $r->readBoundedInt(2, self::MIN_DELAY - 1, self::MAX_DELAY - 1) + 1;
|
||||
$this->delay = $r->readBoundedInt(2, self::MIN_DELAY, self::MAX_DELAY);
|
||||
$this->powered = $r->readBool();
|
||||
}
|
||||
|
||||
protected function encodeState(RuntimeDataWriter $w) : void{
|
||||
$w->writeHorizontalFacing($this->facing);
|
||||
$w->writeInt(2, $this->delay - 1);
|
||||
$w->writeBoundedInt(2, self::MIN_DELAY, self::MAX_DELAY, $this->delay);
|
||||
$w->writeBool($this->powered);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user