Make Block::decodeState() and encodeState() more codegen-friendly

This commit is contained in:
Dylan K. Taylor
2022-07-18 15:48:03 +01:00
parent b8d1b00985
commit cf34f88a67
4 changed files with 72 additions and 25 deletions

View File

@ -43,15 +43,11 @@ class Vine extends Flowable{
public function getRequiredStateDataBits() : int{ return 4; }
protected function decodeState(RuntimeDataReader $r) : void{
foreach(Facing::HORIZONTAL as $facing){
$this->setFace($facing, $r->readBool());
}
$this->faces = $r->readHorizontalFacingFlags();
}
protected function encodeState(RuntimeDataWriter $w) : void{
foreach(Facing::HORIZONTAL as $facing){
$w->writeBool($this->hasFace($facing));
}
$w->writeHorizontalFacingFlags($this->faces);
}
/** @return int[] */