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:
Dylan K. Taylor
2022-07-18 18:25:41 +01:00
parent cf34f88a67
commit 6d4279671e
90 changed files with 380 additions and 717 deletions

View File

@ -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; }