diff --git a/build/generate-runtime-enum-serializers.php b/build/generate-runtime-enum-serializers.php index cb30ef3df..d4b723814 100644 --- a/build/generate-runtime-enum-serializers.php +++ b/build/generate-runtime-enum-serializers.php @@ -64,8 +64,8 @@ function buildWriterFunc(string $virtualTypeName, string $nativeTypeName, array $bits = getBitsRequired($memberNames); $lines = []; - $lines[] = "public function $functionName(\\$nativeTypeName \$value) : void{"; - $lines[] = "\t\$this->int($bits, match(\$value){"; + $lines[] = "public function $functionName(\\$nativeTypeName &\$value) : void{"; + $lines[] = "\t\$this->writeInt($bits, match(\$value){"; foreach($memberNames as $key => $memberName){ $lines[] = "\t\t$memberName => $key,"; @@ -101,6 +101,10 @@ function buildReaderFunc(string $virtualTypeName, string $nativeTypeName, array return $lines; } +function buildInterfaceFunc(string $nativeTypeName, string $functionName) : string{ + return "public function $functionName(\\$nativeTypeName &\$value) : void;"; +} + /** * @param mixed[] $members */ @@ -143,9 +147,10 @@ $readerFuncs = [ ]; $writerFuncs = [ "" => [ - "abstract public function int(int \$bits, int \$value) : void;" + "abstract protected function writeInt(int \$bits, int \$value) : void;" ] ]; +$interfaceFuncs = []; foreach($enumsUsed as $enumMembers){ if(count($enumMembers) === 0){ @@ -169,13 +174,17 @@ foreach($enumsUsed as $enumMembers){ $stringifiedMembers, $functionName ); + $interfaceFuncs[$functionName] = [buildInterfaceFunc( + $nativeTypeName, + $functionName + )]; } /** * @param string[][] $functions * @phpstan-param array> $functions */ -function printFunctions(array $functions, string $className) : void{ +function printFunctions(array $functions, string $className, string $classType) : void{ ksort($functions, SORT_STRING); ob_start(); @@ -213,14 +222,15 @@ namespace pocketmine\data\runtime; HEADER; - echo "trait $className{\n\n"; + echo "$classType $className{\n\n"; echo implode("\n\n", array_map(fn(array $functionLines) => "\t" . implode("\n\t", $functionLines), $functions)); echo "\n\n}\n"; file_put_contents(dirname(__DIR__) . '/src/data/runtime/' . $className . '.php', ob_get_clean()); } -printFunctions($writerFuncs, "RuntimeEnumSerializerTrait"); -printFunctions($readerFuncs, "RuntimeEnumDeserializerTrait"); +printFunctions($writerFuncs, "RuntimeEnumSerializerTrait", "trait"); +printFunctions($readerFuncs, "RuntimeEnumDeserializerTrait", "trait"); +printFunctions($interfaceFuncs, "RuntimeEnumDescriber", "interface"); echo "Done. Don't forget to run CS fixup after generating code.\n"; diff --git a/src/block/Anvil.php b/src/block/Anvil.php index 59b8d17c9..76dc2cede 100644 --- a/src/block/Anvil.php +++ b/src/block/Anvil.php @@ -28,8 +28,7 @@ use pocketmine\block\utils\Fallable; use pocketmine\block\utils\FallableTrait; use pocketmine\block\utils\HorizontalFacingTrait; use pocketmine\block\utils\SupportType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\entity\object\FallingBlock; use pocketmine\item\Item; use pocketmine\math\AxisAlignedBB; @@ -54,13 +53,13 @@ class Anvil extends Transparent implements Fallable{ public function getRequiredTypeDataBits() : int{ return 2; } - protected function describeType(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeType(RuntimeDataDescriber $w) : void{ $w->boundedInt(2, self::UNDAMAGED, self::VERY_DAMAGED, $this->damage); } public function getRequiredStateDataBits() : int{ return 2; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->horizontalFacing($this->facing); } diff --git a/src/block/Bamboo.php b/src/block/Bamboo.php index 2f2640629..b576e771f 100644 --- a/src/block/Bamboo.php +++ b/src/block/Bamboo.php @@ -24,8 +24,7 @@ declare(strict_types=1); namespace pocketmine\block; use pocketmine\block\utils\SupportType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\event\block\StructureGrowEvent; use pocketmine\item\Bamboo as ItemBamboo; use pocketmine\item\Fertilizer; @@ -58,7 +57,7 @@ class Bamboo extends Transparent{ public function getRequiredStateDataBits() : int{ return 4; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->boundedInt(2, self::NO_LEAVES, self::LARGE_LEAVES, $this->leafSize); $w->bool($this->thick); $w->bool($this->ready); diff --git a/src/block/BambooSapling.php b/src/block/BambooSapling.php index b3eba99ff..d5342f6b4 100644 --- a/src/block/BambooSapling.php +++ b/src/block/BambooSapling.php @@ -23,8 +23,7 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\event\block\StructureGrowEvent; use pocketmine\item\Bamboo as ItemBamboo; use pocketmine\item\Fertilizer; @@ -39,7 +38,7 @@ final class BambooSapling extends Flowable{ public function getRequiredStateDataBits() : int{ return 1; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->bool($this->ready); } diff --git a/src/block/Barrel.php b/src/block/Barrel.php index 68c344825..ee732b72c 100644 --- a/src/block/Barrel.php +++ b/src/block/Barrel.php @@ -25,8 +25,7 @@ namespace pocketmine\block; use pocketmine\block\tile\Barrel as TileBarrel; use pocketmine\block\utils\AnyFacingTrait; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\math\Facing; use pocketmine\math\Vector3; @@ -41,7 +40,7 @@ class Barrel extends Opaque{ public function getRequiredStateDataBits() : int{ return 4; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->facing($this->facing); $w->bool($this->open); } diff --git a/src/block/Bed.php b/src/block/Bed.php index 3a5e0ff10..6da2f5aa9 100644 --- a/src/block/Bed.php +++ b/src/block/Bed.php @@ -28,8 +28,7 @@ use pocketmine\block\utils\ColoredTrait; use pocketmine\block\utils\DyeColor; use pocketmine\block\utils\HorizontalFacingTrait; use pocketmine\block\utils\SupportType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\entity\Entity; use pocketmine\entity\Living; use pocketmine\item\Item; @@ -56,7 +55,7 @@ class Bed extends Transparent{ public function getRequiredStateDataBits() : int{ return 4; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->horizontalFacing($this->facing); $w->bool($this->occupied); $w->bool($this->head); diff --git a/src/block/Bedrock.php b/src/block/Bedrock.php index b4252d27c..5095d3a64 100644 --- a/src/block/Bedrock.php +++ b/src/block/Bedrock.php @@ -23,15 +23,14 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; class Bedrock extends Opaque{ private bool $burnsForever = false; public function getRequiredStateDataBits() : int{ return 1; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->bool($this->burnsForever); } diff --git a/src/block/Bell.php b/src/block/Bell.php index 85c4ecaaf..20942f1df 100644 --- a/src/block/Bell.php +++ b/src/block/Bell.php @@ -27,8 +27,7 @@ use pocketmine\block\tile\Bell as TileBell; use pocketmine\block\utils\BellAttachmentType; use pocketmine\block\utils\HorizontalFacingTrait; use pocketmine\block\utils\SupportType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\entity\projectile\Projectile; use pocketmine\item\Item; use pocketmine\math\AxisAlignedBB; @@ -51,7 +50,7 @@ final class Bell extends Transparent{ public function getRequiredStateDataBits() : int{ return 4; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->bellAttachmentType($this->attachmentType); $w->horizontalFacing($this->facing); } diff --git a/src/block/Block.php b/src/block/Block.php index 1481284a8..2dce0a49a 100644 --- a/src/block/Block.php +++ b/src/block/Block.php @@ -29,6 +29,7 @@ namespace pocketmine\block; use pocketmine\block\tile\Spawnable; use pocketmine\block\tile\Tile; use pocketmine\block\utils\SupportType; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\data\runtime\RuntimeDataReader; use pocketmine\data\runtime\RuntimeDataWriter; use pocketmine\entity\Entity; @@ -174,7 +175,7 @@ class Block{ $stateBits = $this->getRequiredStateDataBits(); $requiredBits = $typeBits + $stateBits; $writer = new RuntimeDataWriter($requiredBits); - $writer->int($typeBits, $this->computeTypeData()); + $writer->writeInt($typeBits, $this->computeTypeData()); $this->describeState($writer); $writtenBits = $writer->getOffset() - $typeBits; @@ -185,11 +186,11 @@ class Block{ return $writer->getValue(); } - protected function describeType(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeType(RuntimeDataDescriber $w) : void{ //NOOP } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ //NOOP } diff --git a/src/block/BrewingStand.php b/src/block/BrewingStand.php index cdc34eef9..033d93df0 100644 --- a/src/block/BrewingStand.php +++ b/src/block/BrewingStand.php @@ -26,8 +26,7 @@ namespace pocketmine\block; use pocketmine\block\tile\BrewingStand as TileBrewingStand; use pocketmine\block\utils\BrewingStandSlot; use pocketmine\block\utils\SupportType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\math\Axis; use pocketmine\math\AxisAlignedBB; @@ -46,7 +45,7 @@ class BrewingStand extends Transparent{ public function getRequiredStateDataBits() : int{ return 3; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->brewingStandSlots($this->slots); } diff --git a/src/block/Button.php b/src/block/Button.php index 64a953b7b..6274b7e69 100644 --- a/src/block/Button.php +++ b/src/block/Button.php @@ -24,8 +24,7 @@ declare(strict_types=1); namespace pocketmine\block; use pocketmine\block\utils\AnyFacingTrait; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\math\Facing; use pocketmine\math\Vector3; @@ -41,7 +40,7 @@ abstract class Button extends Flowable{ public function getRequiredStateDataBits() : int{ return 4; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->facing($this->facing); $w->bool($this->pressed); } diff --git a/src/block/Cactus.php b/src/block/Cactus.php index 2f384b923..8828219d8 100644 --- a/src/block/Cactus.php +++ b/src/block/Cactus.php @@ -24,8 +24,7 @@ declare(strict_types=1); namespace pocketmine\block; use pocketmine\block\utils\SupportType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\entity\Entity; use pocketmine\event\block\BlockGrowEvent; use pocketmine\event\entity\EntityDamageByBlockEvent; @@ -44,7 +43,7 @@ class Cactus extends Transparent{ public function getRequiredStateDataBits() : int{ return 4; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->boundedInt(4, 0, self::MAX_AGE, $this->age); } diff --git a/src/block/Cake.php b/src/block/Cake.php index a17a767c1..8870968c2 100644 --- a/src/block/Cake.php +++ b/src/block/Cake.php @@ -23,8 +23,7 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\item\ItemBlock; use pocketmine\math\AxisAlignedBB; @@ -39,7 +38,7 @@ class Cake extends BaseCake{ public function getRequiredStateDataBits() : int{ return 3; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->boundedInt(3, 0, self::MAX_BITES, $this->bites); } diff --git a/src/block/Candle.php b/src/block/Candle.php index 9afc4c6de..b382c0fe5 100644 --- a/src/block/Candle.php +++ b/src/block/Candle.php @@ -25,8 +25,7 @@ namespace pocketmine\block; use pocketmine\block\utils\CandleTrait; use pocketmine\block\utils\SupportType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\math\Axis; use pocketmine\math\AxisAlignedBB; @@ -51,7 +50,7 @@ class Candle extends Transparent{ return 3; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $this->encodeLitState($w); $w->boundedInt(2, self::MIN_COUNT, self::MAX_COUNT, $this->count); } diff --git a/src/block/ChorusFlower.php b/src/block/ChorusFlower.php index 2a0c9ac02..8b20b0e3d 100644 --- a/src/block/ChorusFlower.php +++ b/src/block/ChorusFlower.php @@ -23,8 +23,7 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\entity\projectile\Projectile; use pocketmine\event\block\StructureGrowEvent; use pocketmine\item\Item; @@ -52,7 +51,7 @@ final class ChorusFlower extends Flowable{ public function getRequiredStateDataBits() : int{ return 3; } - protected function describeState(RuntimeDataWriter|RuntimeDataReader $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->boundedInt(3, self::MIN_AGE, self::MAX_AGE, $this->age); } diff --git a/src/block/CocoaBlock.php b/src/block/CocoaBlock.php index 47213f82f..02c4390b9 100644 --- a/src/block/CocoaBlock.php +++ b/src/block/CocoaBlock.php @@ -26,8 +26,7 @@ namespace pocketmine\block; use pocketmine\block\utils\HorizontalFacingTrait; use pocketmine\block\utils\SupportType; use pocketmine\block\utils\WoodType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\event\block\BlockGrowEvent; use pocketmine\item\Fertilizer; use pocketmine\item\Item; @@ -49,7 +48,7 @@ class CocoaBlock extends Transparent{ public function getRequiredStateDataBits() : int{ return 4; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->horizontalFacing($this->facing); $w->boundedInt(2, 0, self::MAX_AGE, $this->age); } diff --git a/src/block/Crops.php b/src/block/Crops.php index 4052485c6..aabab87bb 100644 --- a/src/block/Crops.php +++ b/src/block/Crops.php @@ -23,8 +23,7 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\event\block\BlockGrowEvent; use pocketmine\item\Fertilizer; use pocketmine\item\Item; @@ -41,7 +40,7 @@ abstract class Crops extends Flowable{ public function getRequiredStateDataBits() : int{ return 3; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->boundedInt(3, 0, self::MAX_AGE, $this->age); } diff --git a/src/block/DaylightSensor.php b/src/block/DaylightSensor.php index 2fdcfdef4..27ec3764e 100644 --- a/src/block/DaylightSensor.php +++ b/src/block/DaylightSensor.php @@ -25,8 +25,7 @@ namespace pocketmine\block; use pocketmine\block\utils\AnalogRedstoneSignalEmitterTrait; use pocketmine\block\utils\SupportType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\math\AxisAlignedBB; use pocketmine\math\Facing; @@ -44,7 +43,7 @@ class DaylightSensor extends Transparent{ public function getRequiredStateDataBits() : int{ return 5; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->boundedInt(4, 0, 15, $this->signalStrength); $w->bool($this->inverted); } diff --git a/src/block/DetectorRail.php b/src/block/DetectorRail.php index 92c60f9f8..032f30870 100644 --- a/src/block/DetectorRail.php +++ b/src/block/DetectorRail.php @@ -23,15 +23,14 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; class DetectorRail extends StraightOnlyRail{ protected bool $activated = false; public function getRequiredStateDataBits() : int{ return 4; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ parent::describeState($w); $w->bool($this->activated); } diff --git a/src/block/Dirt.php b/src/block/Dirt.php index d0b38806a..ead1e0c83 100644 --- a/src/block/Dirt.php +++ b/src/block/Dirt.php @@ -24,8 +24,7 @@ declare(strict_types=1); namespace pocketmine\block; use pocketmine\block\utils\DirtType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Fertilizer; use pocketmine\item\Hoe; use pocketmine\item\Item; @@ -48,7 +47,7 @@ class Dirt extends Opaque{ public function getRequiredTypeDataBits() : int{ return 2; } - protected function describeType(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeType(RuntimeDataDescriber $w) : void{ $w->dirtType($this->dirtType); } diff --git a/src/block/Door.php b/src/block/Door.php index 263d854aa..b0eba797c 100644 --- a/src/block/Door.php +++ b/src/block/Door.php @@ -25,8 +25,7 @@ namespace pocketmine\block; use pocketmine\block\utils\HorizontalFacingTrait; use pocketmine\block\utils\SupportType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\math\AxisAlignedBB; use pocketmine\math\Facing; @@ -44,7 +43,7 @@ class Door extends Transparent{ public function getRequiredStateDataBits() : int{ return 5; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->horizontalFacing($this->facing); $w->bool($this->top); $w->bool($this->hingeRight); diff --git a/src/block/DoublePlant.php b/src/block/DoublePlant.php index 6d6c80f0f..00c967271 100644 --- a/src/block/DoublePlant.php +++ b/src/block/DoublePlant.php @@ -23,8 +23,7 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\math\Facing; use pocketmine\math\Vector3; @@ -36,7 +35,7 @@ class DoublePlant extends Flowable{ public function getRequiredStateDataBits() : int{ return 1; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->bool($this->top); } diff --git a/src/block/EndPortalFrame.php b/src/block/EndPortalFrame.php index 2e4250984..f4e08393f 100644 --- a/src/block/EndPortalFrame.php +++ b/src/block/EndPortalFrame.php @@ -25,8 +25,7 @@ namespace pocketmine\block; use pocketmine\block\utils\FacesOppositePlacingPlayerTrait; use pocketmine\block\utils\HorizontalFacingTrait; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\math\AxisAlignedBB; use pocketmine\math\Facing; @@ -38,7 +37,7 @@ class EndPortalFrame extends Opaque{ public function getRequiredStateDataBits() : int{ return 3; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->horizontalFacing($this->facing); $w->bool($this->eye); } diff --git a/src/block/Farmland.php b/src/block/Farmland.php index 2e80c5d2a..cdc3b464e 100644 --- a/src/block/Farmland.php +++ b/src/block/Farmland.php @@ -23,8 +23,7 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\entity\Entity; use pocketmine\entity\Living; use pocketmine\event\entity\EntityTrampleFarmlandEvent; @@ -40,7 +39,7 @@ class Farmland extends Transparent{ public function getRequiredStateDataBits() : int{ return 3; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->boundedInt(3, 0, self::MAX_WETNESS, $this->wetness); } diff --git a/src/block/FenceGate.php b/src/block/FenceGate.php index 96cb41d4e..75ffccbea 100644 --- a/src/block/FenceGate.php +++ b/src/block/FenceGate.php @@ -26,8 +26,7 @@ namespace pocketmine\block; use pocketmine\block\utils\HorizontalFacingTrait; use pocketmine\block\utils\SupportType; use pocketmine\block\utils\WoodTypeTrait; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\math\AxisAlignedBB; use pocketmine\math\Facing; @@ -45,7 +44,7 @@ class FenceGate extends Transparent{ public function getRequiredStateDataBits() : int{ return 4; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->horizontalFacing($this->facing); $w->bool($this->open); $w->bool($this->inWall); diff --git a/src/block/FillableCauldron.php b/src/block/FillableCauldron.php index acc16e575..048b3f312 100644 --- a/src/block/FillableCauldron.php +++ b/src/block/FillableCauldron.php @@ -24,8 +24,7 @@ declare(strict_types=1); namespace pocketmine\block; use pocketmine\block\utils\SupportType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\math\AxisAlignedBB; use pocketmine\math\Facing; @@ -42,7 +41,7 @@ abstract class FillableCauldron extends Transparent{ return 3; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->boundedInt(3, self::MIN_FILL_LEVEL, self::MAX_FILL_LEVEL, $this->fillLevel); } diff --git a/src/block/Fire.php b/src/block/Fire.php index df3f8c79f..8184caf6d 100644 --- a/src/block/Fire.php +++ b/src/block/Fire.php @@ -23,8 +23,7 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\event\block\BlockBurnEvent; use pocketmine\event\block\BlockSpreadEvent; use pocketmine\math\Facing; @@ -42,7 +41,7 @@ class Fire extends BaseFire{ public function getRequiredStateDataBits() : int{ return 4; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->boundedInt(4, 0, self::MAX_AGE, $this->age); } diff --git a/src/block/FloorCoralFan.php b/src/block/FloorCoralFan.php index a9d53c119..11bfb9e0f 100644 --- a/src/block/FloorCoralFan.php +++ b/src/block/FloorCoralFan.php @@ -23,8 +23,7 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\item\VanillaItems; use pocketmine\math\Axis; @@ -40,7 +39,7 @@ final class FloorCoralFan extends BaseCoral{ public function getRequiredStateDataBits() : int{ return parent::getRequiredStateDataBits() + 1; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->horizontalAxis($this->axis); } diff --git a/src/block/Froglight.php b/src/block/Froglight.php index 0e8daa4b6..e93ec2eb8 100644 --- a/src/block/Froglight.php +++ b/src/block/Froglight.php @@ -24,8 +24,7 @@ declare(strict_types=1); namespace pocketmine\block; use pocketmine\block\utils\FroglightType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; final class Froglight extends SimplePillar{ @@ -38,7 +37,7 @@ final class Froglight extends SimplePillar{ public function getRequiredTypeDataBits() : int{ return 2; } - protected function describeType(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeType(RuntimeDataDescriber $w) : void{ $w->froglightType($this->froglightType); } diff --git a/src/block/FrostedIce.php b/src/block/FrostedIce.php index 081e5ad71..c1eacb019 100644 --- a/src/block/FrostedIce.php +++ b/src/block/FrostedIce.php @@ -23,8 +23,7 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\event\block\BlockMeltEvent; use function mt_rand; @@ -35,7 +34,7 @@ class FrostedIce extends Ice{ public function getRequiredStateDataBits() : int{ return 2; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->boundedInt(2, 0, self::MAX_AGE, $this->age); } diff --git a/src/block/Furnace.php b/src/block/Furnace.php index 2147169f2..8cb174985 100644 --- a/src/block/Furnace.php +++ b/src/block/Furnace.php @@ -27,8 +27,7 @@ use pocketmine\block\tile\Furnace as TileFurnace; use pocketmine\block\utils\FacesOppositePlacingPlayerTrait; use pocketmine\block\utils\HorizontalFacingTrait; use pocketmine\crafting\FurnaceType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\math\Vector3; use pocketmine\player\Player; @@ -49,7 +48,7 @@ class Furnace extends Opaque{ public function getRequiredStateDataBits() : int{ return 3; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->horizontalFacing($this->facing); $w->bool($this->lit); } diff --git a/src/block/Hopper.php b/src/block/Hopper.php index 603a48bae..7764a4ee7 100644 --- a/src/block/Hopper.php +++ b/src/block/Hopper.php @@ -26,8 +26,7 @@ namespace pocketmine\block; use pocketmine\block\tile\Hopper as TileHopper; use pocketmine\block\utils\PoweredByRedstoneTrait; use pocketmine\block\utils\SupportType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\math\AxisAlignedBB; use pocketmine\math\Facing; @@ -42,7 +41,7 @@ class Hopper extends Transparent{ public function getRequiredStateDataBits() : int{ return 4; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->facingExcept($this->facing, Facing::UP); $w->bool($this->powered); } diff --git a/src/block/ItemFrame.php b/src/block/ItemFrame.php index 8828a8097..a3c313ca2 100644 --- a/src/block/ItemFrame.php +++ b/src/block/ItemFrame.php @@ -26,8 +26,7 @@ namespace pocketmine\block; use pocketmine\block\tile\ItemFrame as TileItemFrame; use pocketmine\block\utils\AnyFacingTrait; use pocketmine\block\utils\SupportType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\math\Facing; use pocketmine\math\Vector3; @@ -53,7 +52,7 @@ class ItemFrame extends Flowable{ public function getRequiredStateDataBits() : int{ return 4; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->facing($this->facing); $w->bool($this->hasMap); } diff --git a/src/block/Lantern.php b/src/block/Lantern.php index 50df67576..47aa4496f 100644 --- a/src/block/Lantern.php +++ b/src/block/Lantern.php @@ -24,8 +24,7 @@ declare(strict_types=1); namespace pocketmine\block; use pocketmine\block\utils\SupportType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\math\Axis; use pocketmine\math\AxisAlignedBB; @@ -46,7 +45,7 @@ class Lantern extends Transparent{ public function getRequiredStateDataBits() : int{ return 1; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->bool($this->hanging); } diff --git a/src/block/Leaves.php b/src/block/Leaves.php index d4f22c8ac..94d6cbcca 100644 --- a/src/block/Leaves.php +++ b/src/block/Leaves.php @@ -25,8 +25,7 @@ namespace pocketmine\block; use pocketmine\block\utils\LeavesType; use pocketmine\block\utils\SupportType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\event\block\LeavesDecayEvent; use pocketmine\item\Item; use pocketmine\item\VanillaItems; @@ -50,7 +49,7 @@ class Leaves extends Transparent{ public function getRequiredStateDataBits() : int{ return 2; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->bool($this->noDecay); $w->bool($this->checkDecay); } diff --git a/src/block/Lectern.php b/src/block/Lectern.php index c77afd8e1..7a144dbb8 100644 --- a/src/block/Lectern.php +++ b/src/block/Lectern.php @@ -27,8 +27,7 @@ use pocketmine\block\tile\Lectern as TileLectern; use pocketmine\block\utils\FacesOppositePlacingPlayerTrait; use pocketmine\block\utils\HorizontalFacingTrait; use pocketmine\block\utils\SupportType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\item\WritableBookBase; use pocketmine\math\AxisAlignedBB; @@ -49,7 +48,7 @@ class Lectern extends Transparent{ public function getRequiredStateDataBits() : int{ return 3; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->horizontalFacing($this->facing); $w->bool($this->producingSignal); } diff --git a/src/block/Lever.php b/src/block/Lever.php index b82fb04cb..a39937687 100644 --- a/src/block/Lever.php +++ b/src/block/Lever.php @@ -24,8 +24,7 @@ declare(strict_types=1); namespace pocketmine\block; use pocketmine\block\utils\LeverFacing; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\math\Axis; use pocketmine\math\Facing; @@ -47,7 +46,7 @@ class Lever extends Flowable{ public function getRequiredStateDataBits() : int{ return 4; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->leverFacing($this->facing); $w->bool($this->activated); } diff --git a/src/block/Light.php b/src/block/Light.php index 397a8f98d..bdd232b6c 100644 --- a/src/block/Light.php +++ b/src/block/Light.php @@ -23,8 +23,7 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\math\Vector3; use pocketmine\player\Player; @@ -37,7 +36,7 @@ final class Light extends Flowable{ public function getRequiredTypeDataBits() : int{ return 4; } - protected function describeType(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeType(RuntimeDataDescriber $w) : void{ $w->boundedInt(4, self::MIN_LIGHT_LEVEL, self::MAX_LIGHT_LEVEL, $this->level); } diff --git a/src/block/Liquid.php b/src/block/Liquid.php index 769fc039a..4f76d4699 100644 --- a/src/block/Liquid.php +++ b/src/block/Liquid.php @@ -25,8 +25,7 @@ namespace pocketmine\block; use pocketmine\block\utils\MinimumCostFlowCalculator; use pocketmine\block\utils\SupportType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\entity\Entity; use pocketmine\event\block\BlockFormEvent; use pocketmine\event\block\BlockSpreadEvent; @@ -51,7 +50,7 @@ abstract class Liquid extends Transparent{ public function getRequiredStateDataBits() : int{ return 5; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->boundedInt(3, 0, self::MAX_DECAY, $this->decay); $w->bool($this->falling); $w->bool($this->still); diff --git a/src/block/NetherPortal.php b/src/block/NetherPortal.php index 7a12ebd74..873040fd3 100644 --- a/src/block/NetherPortal.php +++ b/src/block/NetherPortal.php @@ -24,8 +24,7 @@ declare(strict_types=1); namespace pocketmine\block; use pocketmine\block\utils\SupportType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\entity\Entity; use pocketmine\item\Item; use pocketmine\math\Axis; @@ -37,7 +36,7 @@ class NetherPortal extends Transparent{ public function getRequiredStateDataBits() : int{ return 1; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->horizontalAxis($this->axis); } diff --git a/src/block/NetherVines.php b/src/block/NetherVines.php index 5b7a46d76..c2c497112 100644 --- a/src/block/NetherVines.php +++ b/src/block/NetherVines.php @@ -24,8 +24,7 @@ declare(strict_types=1); namespace pocketmine\block; use pocketmine\block\utils\SupportType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\entity\Entity; use pocketmine\event\block\StructureGrowEvent; use pocketmine\item\Fertilizer; @@ -57,7 +56,7 @@ class NetherVines extends Flowable{ return 5; } - public function describeState(RuntimeDataWriter|RuntimeDataReader $w) : void{ + public function describeState(RuntimeDataDescriber $w) : void{ $w->boundedInt(5, 0, self::MAX_AGE, $this->age); } diff --git a/src/block/NetherWartPlant.php b/src/block/NetherWartPlant.php index a9325d92f..2d3316b2c 100644 --- a/src/block/NetherWartPlant.php +++ b/src/block/NetherWartPlant.php @@ -23,8 +23,7 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\event\block\BlockGrowEvent; use pocketmine\item\Item; use pocketmine\math\Facing; @@ -40,7 +39,7 @@ class NetherWartPlant extends Flowable{ public function getRequiredStateDataBits() : int{ return 2; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->boundedInt(2, 0, self::MAX_AGE, $this->age); } diff --git a/src/block/Rail.php b/src/block/Rail.php index 31d74c061..2d37f6e95 100644 --- a/src/block/Rail.php +++ b/src/block/Rail.php @@ -25,8 +25,7 @@ namespace pocketmine\block; use pocketmine\block\utils\RailConnectionInfo; use pocketmine\data\bedrock\block\BlockLegacyMetadata; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\math\Facing; use function array_keys; use function implode; @@ -37,7 +36,7 @@ class Rail extends BaseRail{ public function getRequiredStateDataBits() : int{ return 4; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->railShape($this->railShape); } diff --git a/src/block/RedMushroomBlock.php b/src/block/RedMushroomBlock.php index 18ab59bd1..42763ba95 100644 --- a/src/block/RedMushroomBlock.php +++ b/src/block/RedMushroomBlock.php @@ -24,8 +24,7 @@ declare(strict_types=1); namespace pocketmine\block; use pocketmine\block\utils\MushroomBlockType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use function mt_rand; @@ -39,7 +38,7 @@ class RedMushroomBlock extends Opaque{ public function getRequiredStateDataBits() : int{ return 4; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->mushroomBlockType($this->mushroomBlockType); } diff --git a/src/block/RedstoneComparator.php b/src/block/RedstoneComparator.php index 50fe4d28f..e105701d1 100644 --- a/src/block/RedstoneComparator.php +++ b/src/block/RedstoneComparator.php @@ -28,8 +28,7 @@ use pocketmine\block\utils\AnalogRedstoneSignalEmitterTrait; use pocketmine\block\utils\HorizontalFacingTrait; use pocketmine\block\utils\PoweredByRedstoneTrait; use pocketmine\block\utils\SupportType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\math\AxisAlignedBB; use pocketmine\math\Facing; @@ -47,7 +46,7 @@ class RedstoneComparator extends Flowable{ public function getRequiredStateDataBits() : int{ return 4; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->horizontalFacing($this->facing); $w->bool($this->isSubtractMode); $w->bool($this->powered); diff --git a/src/block/RedstoneLamp.php b/src/block/RedstoneLamp.php index 9a8c3785c..5557076b3 100644 --- a/src/block/RedstoneLamp.php +++ b/src/block/RedstoneLamp.php @@ -24,15 +24,14 @@ declare(strict_types=1); namespace pocketmine\block; use pocketmine\block\utils\PoweredByRedstoneTrait; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; class RedstoneLamp extends Opaque{ use PoweredByRedstoneTrait; public function getRequiredStateDataBits() : int{ return 1; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->bool($this->powered); } diff --git a/src/block/RedstoneOre.php b/src/block/RedstoneOre.php index c4f449700..34d463731 100644 --- a/src/block/RedstoneOre.php +++ b/src/block/RedstoneOre.php @@ -23,8 +23,7 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\item\VanillaItems; use pocketmine\math\Vector3; @@ -36,7 +35,7 @@ class RedstoneOre extends Opaque{ public function getRequiredStateDataBits() : int{ return 1; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->bool($this->lit); } diff --git a/src/block/RedstoneRepeater.php b/src/block/RedstoneRepeater.php index b72d25463..212bc9f4e 100644 --- a/src/block/RedstoneRepeater.php +++ b/src/block/RedstoneRepeater.php @@ -26,8 +26,7 @@ namespace pocketmine\block; use pocketmine\block\utils\HorizontalFacingTrait; use pocketmine\block\utils\PoweredByRedstoneTrait; use pocketmine\block\utils\SupportType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\math\AxisAlignedBB; use pocketmine\math\Facing; @@ -46,7 +45,7 @@ class RedstoneRepeater extends Flowable{ public function getRequiredStateDataBits() : int{ return 5; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->horizontalFacing($this->facing); $w->boundedInt(2, self::MIN_DELAY, self::MAX_DELAY, $this->delay); $w->bool($this->powered); diff --git a/src/block/RedstoneTorch.php b/src/block/RedstoneTorch.php index ba37039f2..b36bc9185 100644 --- a/src/block/RedstoneTorch.php +++ b/src/block/RedstoneTorch.php @@ -23,15 +23,14 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; class RedstoneTorch extends Torch{ protected bool $lit = true; public function getRequiredStateDataBits() : int{ return parent::getRequiredStateDataBits() + 1; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ parent::describeState($w); $w->bool($this->lit); } diff --git a/src/block/Sapling.php b/src/block/Sapling.php index cfe301223..ea04ba624 100644 --- a/src/block/Sapling.php +++ b/src/block/Sapling.php @@ -24,8 +24,7 @@ declare(strict_types=1); namespace pocketmine\block; use pocketmine\block\utils\TreeType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\event\block\StructureGrowEvent; use pocketmine\item\Fertilizer; use pocketmine\item\Item; @@ -49,7 +48,7 @@ class Sapling extends Flowable{ public function getRequiredStateDataBits() : int{ return 1; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->bool($this->ready); } diff --git a/src/block/SeaPickle.php b/src/block/SeaPickle.php index fe2cd1dac..770ae6b45 100644 --- a/src/block/SeaPickle.php +++ b/src/block/SeaPickle.php @@ -24,8 +24,7 @@ declare(strict_types=1); namespace pocketmine\block; use pocketmine\block\utils\SupportType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\math\AxisAlignedBB; use pocketmine\math\Vector3; @@ -41,7 +40,7 @@ class SeaPickle extends Transparent{ public function getRequiredStateDataBits() : int{ return 3; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->boundedInt(2, self::MIN_COUNT, self::MAX_COUNT, $this->count); $w->bool($this->underwater); } diff --git a/src/block/ShulkerBox.php b/src/block/ShulkerBox.php index 72236be48..292506deb 100644 --- a/src/block/ShulkerBox.php +++ b/src/block/ShulkerBox.php @@ -25,8 +25,7 @@ namespace pocketmine\block; use pocketmine\block\tile\ShulkerBox as TileShulkerBox; use pocketmine\block\utils\AnyFacingTrait; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\math\Vector3; use pocketmine\player\Player; @@ -37,7 +36,7 @@ class ShulkerBox extends Opaque{ public function getRequiredStateDataBits() : int{ return 0; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ //NOOP - we don't read or write facing here, because the tile persists it } diff --git a/src/block/SimplePressurePlate.php b/src/block/SimplePressurePlate.php index 1d0a9d8c1..f93e244a5 100644 --- a/src/block/SimplePressurePlate.php +++ b/src/block/SimplePressurePlate.php @@ -23,15 +23,14 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; abstract class SimplePressurePlate extends PressurePlate{ protected bool $pressed = false; public function getRequiredStateDataBits() : int{ return 1; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->bool($this->pressed); } diff --git a/src/block/Skull.php b/src/block/Skull.php index b2e02b8d4..36a587aa9 100644 --- a/src/block/Skull.php +++ b/src/block/Skull.php @@ -25,8 +25,7 @@ namespace pocketmine\block; use pocketmine\block\tile\Skull as TileSkull; use pocketmine\block\utils\SkullType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\math\AxisAlignedBB; use pocketmine\math\Facing; @@ -52,13 +51,13 @@ class Skull extends Flowable{ public function getRequiredTypeDataBits() : int{ return 3; } - protected function describeType(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeType(RuntimeDataDescriber $w) : void{ $w->skullType($this->skullType); } public function getRequiredStateDataBits() : int{ return 3; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->facingExcept($this->facing, Facing::DOWN); } diff --git a/src/block/Slab.php b/src/block/Slab.php index a1b09a151..3290648eb 100644 --- a/src/block/Slab.php +++ b/src/block/Slab.php @@ -25,8 +25,7 @@ namespace pocketmine\block; use pocketmine\block\utils\SlabType; use pocketmine\block\utils\SupportType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\math\AxisAlignedBB; use pocketmine\math\Facing; @@ -44,7 +43,7 @@ class Slab extends Transparent{ public function getRequiredStateDataBits() : int{ return 2; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->slabType($this->slabType); } diff --git a/src/block/SnowLayer.php b/src/block/SnowLayer.php index e3628f98a..4f3950e74 100644 --- a/src/block/SnowLayer.php +++ b/src/block/SnowLayer.php @@ -26,8 +26,7 @@ namespace pocketmine\block; use pocketmine\block\utils\Fallable; use pocketmine\block\utils\FallableTrait; use pocketmine\block\utils\SupportType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\event\block\BlockMeltEvent; use pocketmine\item\Item; use pocketmine\item\VanillaItems; @@ -49,7 +48,7 @@ class SnowLayer extends Flowable implements Fallable{ public function getRequiredStateDataBits() : int{ return 3; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->boundedInt(3, self::MIN_LAYERS, self::MAX_LAYERS, $this->layers); } diff --git a/src/block/Sponge.php b/src/block/Sponge.php index d4eceb542..d8784febd 100644 --- a/src/block/Sponge.php +++ b/src/block/Sponge.php @@ -23,15 +23,14 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; class Sponge extends Opaque{ protected bool $wet = false; public function getRequiredTypeDataBits() : int{ return 1; } - protected function describeType(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeType(RuntimeDataDescriber $w) : void{ $w->bool($this->wet); } diff --git a/src/block/Stair.php b/src/block/Stair.php index 83569e8b1..afbbf7918 100644 --- a/src/block/Stair.php +++ b/src/block/Stair.php @@ -26,8 +26,7 @@ namespace pocketmine\block; use pocketmine\block\utils\HorizontalFacingTrait; use pocketmine\block\utils\StairShape; use pocketmine\block\utils\SupportType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\math\Axis; use pocketmine\math\AxisAlignedBB; @@ -49,7 +48,7 @@ class Stair extends Transparent{ public function getRequiredStateDataBits() : int{ return 3; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->horizontalFacing($this->facing); $w->bool($this->upsideDown); } diff --git a/src/block/StraightOnlyRail.php b/src/block/StraightOnlyRail.php index 9b8141355..bb9482fe9 100644 --- a/src/block/StraightOnlyRail.php +++ b/src/block/StraightOnlyRail.php @@ -25,8 +25,7 @@ namespace pocketmine\block; use pocketmine\block\utils\RailConnectionInfo; use pocketmine\data\bedrock\block\BlockLegacyMetadata; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use function array_keys; use function implode; @@ -39,7 +38,7 @@ class StraightOnlyRail extends BaseRail{ public function getRequiredStateDataBits() : int{ return 3; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->straightOnlyRailShape($this->railShape); } diff --git a/src/block/Sugarcane.php b/src/block/Sugarcane.php index 69951dce4..a23c6d74d 100644 --- a/src/block/Sugarcane.php +++ b/src/block/Sugarcane.php @@ -23,8 +23,7 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\event\block\BlockGrowEvent; use pocketmine\item\Fertilizer; use pocketmine\item\Item; @@ -41,7 +40,7 @@ class Sugarcane extends Flowable{ public function getRequiredStateDataBits() : int{ return 4; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->boundedInt(4, 0, self::MAX_AGE, $this->age); } diff --git a/src/block/SweetBerryBush.php b/src/block/SweetBerryBush.php index f7b8b1c02..a93306da9 100644 --- a/src/block/SweetBerryBush.php +++ b/src/block/SweetBerryBush.php @@ -23,8 +23,7 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\entity\Entity; use pocketmine\entity\Living; use pocketmine\event\block\BlockGrowEvent; @@ -48,7 +47,7 @@ class SweetBerryBush extends Flowable{ public function getRequiredStateDataBits() : int{ return 3; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->boundedInt(3, self::STAGE_SAPLING, self::STAGE_MATURE, $this->age); } diff --git a/src/block/TNT.php b/src/block/TNT.php index cf1158a67..1206d0e30 100644 --- a/src/block/TNT.php +++ b/src/block/TNT.php @@ -23,8 +23,7 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\entity\Location; use pocketmine\entity\object\PrimedTNT; use pocketmine\entity\projectile\Projectile; @@ -48,13 +47,13 @@ class TNT extends Opaque{ public function getRequiredTypeDataBits() : int{ return 1; } - protected function describeType(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeType(RuntimeDataDescriber $w) : void{ $w->bool($this->worksUnderwater); } public function getRequiredStateDataBits() : int{ return 1; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->bool($this->unstable); } diff --git a/src/block/Torch.php b/src/block/Torch.php index 0542c2be6..5b496c9ad 100644 --- a/src/block/Torch.php +++ b/src/block/Torch.php @@ -24,8 +24,7 @@ declare(strict_types=1); namespace pocketmine\block; use pocketmine\block\utils\SupportType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\math\Axis; use pocketmine\math\Facing; @@ -39,7 +38,7 @@ class Torch extends Flowable{ public function getRequiredStateDataBits() : int{ return 3; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->facingExcept($this->facing, Facing::DOWN); } diff --git a/src/block/Trapdoor.php b/src/block/Trapdoor.php index 8f6d5aab1..83bf4693e 100644 --- a/src/block/Trapdoor.php +++ b/src/block/Trapdoor.php @@ -25,8 +25,7 @@ namespace pocketmine\block; use pocketmine\block\utils\HorizontalFacingTrait; use pocketmine\block\utils\SupportType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\math\AxisAlignedBB; use pocketmine\math\Facing; @@ -43,7 +42,7 @@ class Trapdoor extends Transparent{ public function getRequiredStateDataBits() : int{ return 4; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->horizontalFacing($this->facing); $w->bool($this->top); $w->bool($this->open); diff --git a/src/block/Tripwire.php b/src/block/Tripwire.php index 74d55ffba..c785e6d12 100644 --- a/src/block/Tripwire.php +++ b/src/block/Tripwire.php @@ -23,8 +23,7 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\item\VanillaItems; @@ -36,7 +35,7 @@ class Tripwire extends Flowable{ public function getRequiredStateDataBits() : int{ return 4; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->bool($this->triggered); $w->bool($this->suspended); $w->bool($this->connected); diff --git a/src/block/TripwireHook.php b/src/block/TripwireHook.php index cb39e42d0..9180f971f 100644 --- a/src/block/TripwireHook.php +++ b/src/block/TripwireHook.php @@ -24,8 +24,7 @@ declare(strict_types=1); namespace pocketmine\block; use pocketmine\block\utils\HorizontalFacingTrait; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\math\Axis; use pocketmine\math\Facing; @@ -41,7 +40,7 @@ class TripwireHook extends Flowable{ public function getRequiredStateDataBits() : int{ return 4; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->horizontalFacing($this->facing); $w->bool($this->connected); $w->bool($this->powered); diff --git a/src/block/UnknownBlock.php b/src/block/UnknownBlock.php index dd4a934c3..f3faeb689 100644 --- a/src/block/UnknownBlock.php +++ b/src/block/UnknownBlock.php @@ -23,8 +23,7 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; /** @@ -41,7 +40,7 @@ class UnknownBlock extends Transparent{ public function getRequiredTypeDataBits() : int{ return Block::INTERNAL_STATE_DATA_BITS; } - protected function describeType(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeType(RuntimeDataDescriber $w) : void{ //use type instead of state, so we don't lose any information like colour //this might be an improperly registered plugin block $w->int(Block::INTERNAL_STATE_DATA_BITS, $this->stateData); diff --git a/src/block/Vine.php b/src/block/Vine.php index 0ba00fee6..65c6d59ae 100644 --- a/src/block/Vine.php +++ b/src/block/Vine.php @@ -23,8 +23,7 @@ declare(strict_types=1); namespace pocketmine\block; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\entity\Entity; use pocketmine\item\Item; use pocketmine\math\Axis; @@ -42,7 +41,7 @@ class Vine extends Flowable{ public function getRequiredStateDataBits() : int{ return 4; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->horizontalFacingFlags($this->faces); } diff --git a/src/block/Wall.php b/src/block/Wall.php index 817df1658..84b45150c 100644 --- a/src/block/Wall.php +++ b/src/block/Wall.php @@ -25,8 +25,7 @@ namespace pocketmine\block; use pocketmine\block\utils\SupportType; use pocketmine\block\utils\WallConnectionType; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\math\Axis; use pocketmine\math\AxisAlignedBB; use pocketmine\math\Facing; @@ -45,7 +44,7 @@ class Wall extends Transparent{ public function getRequiredStateDataBits() : int{ return 9; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->wallConnections($this->connections); $w->bool($this->post); } diff --git a/src/block/WallCoralFan.php b/src/block/WallCoralFan.php index e100170f4..f50438c6e 100644 --- a/src/block/WallCoralFan.php +++ b/src/block/WallCoralFan.php @@ -24,8 +24,7 @@ declare(strict_types=1); namespace pocketmine\block; use pocketmine\block\utils\HorizontalFacingTrait; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\item\VanillaItems; use pocketmine\math\Axis; @@ -39,7 +38,7 @@ final class WallCoralFan extends BaseCoral{ public function getRequiredStateDataBits() : int{ return parent::getRequiredStateDataBits() + 2; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->horizontalFacing($this->facing); } diff --git a/src/block/Wood.php b/src/block/Wood.php index cadc32036..5ffd1c775 100644 --- a/src/block/Wood.php +++ b/src/block/Wood.php @@ -25,8 +25,7 @@ namespace pocketmine\block; use pocketmine\block\utils\PillarRotationTrait; use pocketmine\block\utils\WoodTypeTrait; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Axe; use pocketmine\item\Item; use pocketmine\math\Vector3; @@ -41,7 +40,7 @@ class Wood extends Opaque{ public function getRequiredTypeDataBits() : int{ return 1; } - protected function describeType(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeType(RuntimeDataDescriber $w) : void{ $w->bool($this->stripped); } diff --git a/src/block/utils/AnalogRedstoneSignalEmitterTrait.php b/src/block/utils/AnalogRedstoneSignalEmitterTrait.php index 4c8cd5be9..5247e7576 100644 --- a/src/block/utils/AnalogRedstoneSignalEmitterTrait.php +++ b/src/block/utils/AnalogRedstoneSignalEmitterTrait.php @@ -23,15 +23,14 @@ declare(strict_types=1); namespace pocketmine\block\utils; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; trait AnalogRedstoneSignalEmitterTrait{ protected int $signalStrength = 0; public function getRequiredStateDataBits() : int{ return 4; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->boundedInt(4, 0, 15, $this->signalStrength); } diff --git a/src/block/utils/AnyFacingTrait.php b/src/block/utils/AnyFacingTrait.php index cf98507d3..0788c1aca 100644 --- a/src/block/utils/AnyFacingTrait.php +++ b/src/block/utils/AnyFacingTrait.php @@ -23,8 +23,7 @@ declare(strict_types=1); namespace pocketmine\block\utils; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\math\Facing; trait AnyFacingTrait{ @@ -32,7 +31,7 @@ trait AnyFacingTrait{ public function getRequiredStateDataBits() : int{ return 3; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->facing($this->facing); } diff --git a/src/block/utils/CandleTrait.php b/src/block/utils/CandleTrait.php index bb1e3fba3..1391382e4 100644 --- a/src/block/utils/CandleTrait.php +++ b/src/block/utils/CandleTrait.php @@ -24,8 +24,7 @@ declare(strict_types=1); namespace pocketmine\block\utils; use pocketmine\block\Block; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\entity\projectile\Projectile; use pocketmine\item\Durable; use pocketmine\item\enchantment\VanillaEnchantments; @@ -42,7 +41,7 @@ trait CandleTrait{ public function getRequiredStateDataBits() : int{ return 1; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->bool($this->lit); } diff --git a/src/block/utils/ColoredTrait.php b/src/block/utils/ColoredTrait.php index 00e0d61a2..ce7113159 100644 --- a/src/block/utils/ColoredTrait.php +++ b/src/block/utils/ColoredTrait.php @@ -24,8 +24,7 @@ declare(strict_types=1); namespace pocketmine\block\utils; use pocketmine\block\Block; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; trait ColoredTrait{ /** @var DyeColor */ @@ -34,7 +33,7 @@ trait ColoredTrait{ public function getRequiredTypeDataBits() : int{ return 4; } /** @see Block::describeType() */ - protected function describeType(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeType(RuntimeDataDescriber $w) : void{ $w->dyeColor($this->color); } diff --git a/src/block/utils/CopperTrait.php b/src/block/utils/CopperTrait.php index 6bbb4fa37..0842d1351 100644 --- a/src/block/utils/CopperTrait.php +++ b/src/block/utils/CopperTrait.php @@ -25,8 +25,7 @@ namespace pocketmine\block\utils; use pocketmine\block\BlockIdentifier; use pocketmine\block\BlockTypeInfo; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Axe; use pocketmine\item\Item; use pocketmine\item\ItemTypeIds; @@ -47,7 +46,7 @@ trait CopperTrait{ public function getRequiredTypeDataBits() : int{ return 3; } - protected function describeType(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeType(RuntimeDataDescriber $w) : void{ $w->copperOxidation($this->oxidation); $w->bool($this->waxed); } diff --git a/src/block/utils/CoralTypeTrait.php b/src/block/utils/CoralTypeTrait.php index ccab725e1..3e362394a 100644 --- a/src/block/utils/CoralTypeTrait.php +++ b/src/block/utils/CoralTypeTrait.php @@ -24,8 +24,7 @@ declare(strict_types=1); namespace pocketmine\block\utils; use pocketmine\block\Block; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; trait CoralTypeTrait{ protected CoralType $coralType; @@ -34,7 +33,7 @@ trait CoralTypeTrait{ public function getRequiredTypeDataBits() : int{ return 4; } /** @see Block::describeType() */ - protected function describeType(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeType(RuntimeDataDescriber $w) : void{ $w->coralType($this->coralType); $w->bool($this->dead); } diff --git a/src/block/utils/HorizontalFacingTrait.php b/src/block/utils/HorizontalFacingTrait.php index 437dd2cf3..283cba078 100644 --- a/src/block/utils/HorizontalFacingTrait.php +++ b/src/block/utils/HorizontalFacingTrait.php @@ -23,8 +23,7 @@ declare(strict_types=1); namespace pocketmine\block\utils; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\math\Axis; use pocketmine\math\Facing; @@ -33,7 +32,7 @@ trait HorizontalFacingTrait{ public function getRequiredStateDataBits() : int{ return 2; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->horizontalFacing($this->facing); } diff --git a/src/block/utils/PillarRotationTrait.php b/src/block/utils/PillarRotationTrait.php index 8c1480b03..9b898ca15 100644 --- a/src/block/utils/PillarRotationTrait.php +++ b/src/block/utils/PillarRotationTrait.php @@ -24,8 +24,7 @@ declare(strict_types=1); namespace pocketmine\block\utils; use pocketmine\block\Block; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\item\Item; use pocketmine\math\Axis; use pocketmine\math\Facing; @@ -38,7 +37,7 @@ trait PillarRotationTrait{ public function getRequiredStateDataBits() : int{ return 2; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->axis($this->axis); } diff --git a/src/block/utils/RailPoweredByRedstoneTrait.php b/src/block/utils/RailPoweredByRedstoneTrait.php index 64a03f35e..19801ee10 100644 --- a/src/block/utils/RailPoweredByRedstoneTrait.php +++ b/src/block/utils/RailPoweredByRedstoneTrait.php @@ -23,15 +23,14 @@ declare(strict_types=1); namespace pocketmine\block\utils; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; trait RailPoweredByRedstoneTrait{ use PoweredByRedstoneTrait; public function getRequiredStateDataBits() : int{ return parent::getRequiredStateDataBits() + 1; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ parent::describeState($w); $w->bool($this->powered); } diff --git a/src/block/utils/SignLikeRotationTrait.php b/src/block/utils/SignLikeRotationTrait.php index e2c6d7609..9fb03b8a4 100644 --- a/src/block/utils/SignLikeRotationTrait.php +++ b/src/block/utils/SignLikeRotationTrait.php @@ -23,8 +23,7 @@ declare(strict_types=1); namespace pocketmine\block\utils; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use function floor; trait SignLikeRotationTrait{ @@ -33,7 +32,7 @@ trait SignLikeRotationTrait{ public function getRequiredStateDataBits() : int{ return 4; } - protected function describeState(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeState(RuntimeDataDescriber $w) : void{ $w->boundedInt(4, 0, 15, $this->rotation); } diff --git a/src/data/runtime/RuntimeDataDescriber.php b/src/data/runtime/RuntimeDataDescriber.php new file mode 100644 index 000000000..e983cea31 --- /dev/null +++ b/src/data/runtime/RuntimeDataDescriber.php @@ -0,0 +1,67 @@ + $connections + */ + public function wallConnections(array &$connections) : void; + + /** + * @param BrewingStandSlot[] $slots + * @phpstan-param array $slots + */ + public function brewingStandSlots(array &$slots) : void; + + public function railShape(int &$railShape) : void; + + public function straightOnlyRailShape(int &$railShape) : void; +} diff --git a/src/data/runtime/RuntimeDataReader.php b/src/data/runtime/RuntimeDataReader.php index f09d857f5..14fbca209 100644 --- a/src/data/runtime/RuntimeDataReader.php +++ b/src/data/runtime/RuntimeDataReader.php @@ -30,7 +30,7 @@ use pocketmine\math\Axis; use pocketmine\math\Facing; use pocketmine\utils\AssumptionFailedError; -final class RuntimeDataReader{ +final class RuntimeDataReader implements RuntimeDataDescriber{ use RuntimeEnumDeserializerTrait; private int $offset = 0; @@ -55,12 +55,16 @@ final class RuntimeDataReader{ $value = $this->readInt($bits); } - public function boundedInt(int $bits, int $min, int $max, int &$value) : void{ + protected function readBoundedInt(int $bits, int $min, int $max) : int{ $result = $this->readInt($bits) + $min; if($result < $min || $result > $max){ throw new InvalidSerializedRuntimeDataException("Value is outside the range $min - $max"); } - $value = $result; + return $result; + } + + public function boundedInt(int $bits, int $min, int $max, int &$value) : void{ + $value = $this->readBoundedInt($bits, $min, $max); } protected function readBool() : bool{ @@ -142,8 +146,7 @@ final class RuntimeDataReader{ $result = []; //TODO: we can pack this into 7 bits instead of 8 foreach(Facing::HORIZONTAL as $facing){ - $type = 0; - $this->boundedInt(2, 0, 2, $type); + $type = $this->readBoundedInt(2, 0, 2); if($type !== 0){ $result[$facing] = match($type){ 1 => WallConnectionType::SHORT(), diff --git a/src/data/runtime/RuntimeDataWriter.php b/src/data/runtime/RuntimeDataWriter.php index 23aa45b39..feaef3698 100644 --- a/src/data/runtime/RuntimeDataWriter.php +++ b/src/data/runtime/RuntimeDataWriter.php @@ -30,7 +30,7 @@ use pocketmine\math\Facing; use pocketmine\utils\AssumptionFailedError; use function array_flip; -final class RuntimeDataWriter{ +final class RuntimeDataWriter implements RuntimeDataDescriber{ use RuntimeEnumSerializerTrait; private int $value = 0; @@ -40,7 +40,7 @@ final class RuntimeDataWriter{ private int $maxBits ){} - public function int(int $bits, int $value) : void{ + public function writeInt(int $bits, int $value) : void{ if($this->offset + $bits > $this->maxBits){ throw new \InvalidArgumentException("Bit buffer cannot be larger than $this->maxBits bits (already have $this->offset bits)"); } @@ -52,19 +52,31 @@ final class RuntimeDataWriter{ $this->offset += $bits; } - public function boundedInt(int $bits, int $min, int $max, int $value) : void{ + public function int(int $bits, int &$value) : void{ + $this->writeInt($bits, $value); + } + + protected function writeBoundedInt(int $bits, int $min, int $max, int $value) : void{ if($value < $min || $value > $max){ throw new \InvalidArgumentException("Value $value is outside the range $min - $max"); } - $this->int($bits, $value - $min); + $this->writeInt($bits, $value - $min); } - public function bool(bool $value) : void{ - $this->int(1, $value ? 1 : 0); + public function boundedInt(int $bits, int $min, int $max, int &$value) : void{ + $this->writeBoundedInt($bits, $min, $max, $value); } - public function horizontalFacing(int $facing) : void{ - $this->int(2, match($facing){ + protected function writeBool(bool $value) : void{ + $this->writeInt(1, $value ? 1 : 0); + } + + public function bool(bool &$value) : void{ + $this->writeBool($value); + } + + public function horizontalFacing(int &$facing) : void{ + $this->writeInt(2, match($facing){ Facing::NORTH => 0, Facing::EAST => 1, Facing::SOUTH => 2, @@ -76,15 +88,15 @@ final class RuntimeDataWriter{ /** * @param int[] $faces */ - public function horizontalFacingFlags(array $faces) : void{ + public function horizontalFacingFlags(array &$faces) : void{ $uniqueFaces = array_flip($faces); foreach(Facing::HORIZONTAL as $facing){ - $this->bool(isset($uniqueFaces[$facing])); + $this->writeBool(isset($uniqueFaces[$facing])); } } - public function facing(int $facing) : void{ - $this->int(3, match($facing){ + public function facing(int &$facing) : void{ + $this->writeInt(3, match($facing){ 0 => Facing::DOWN, 1 => Facing::UP, 2 => Facing::NORTH, @@ -95,12 +107,12 @@ final class RuntimeDataWriter{ }); } - public function facingExcept(int $facing, int $except) : void{ + public function facingExcept(int &$facing, int $except) : void{ $this->facing($facing); } - public function axis(int $axis) : void{ - $this->int(2, match($axis){ + public function axis(int &$axis) : void{ + $this->writeInt(2, match($axis){ Axis::X => 0, Axis::Z => 1, Axis::Y => 2, @@ -108,8 +120,8 @@ final class RuntimeDataWriter{ }); } - public function horizontalAxis(int $axis) : void{ - $this->int(1, match($axis){ + public function horizontalAxis(int &$axis) : void{ + $this->writeInt(1, match($axis){ Axis::X => 0, Axis::Z => 1, default => throw new \InvalidArgumentException("Invalid horizontal axis $axis") @@ -120,10 +132,10 @@ final class RuntimeDataWriter{ * @param WallConnectionType[] $connections * @phpstan-param array $connections */ - public function wallConnections(array $connections) : void{ + public function wallConnections(array &$connections) : void{ //TODO: we can pack this into 7 bits instead of 8 foreach(Facing::HORIZONTAL as $facing){ - $this->boundedInt(2, 0, 2, match($connections[$facing] ?? null){ + $this->writeBoundedInt(2, 0, 2, match($connections[$facing] ?? null){ null => 0, WallConnectionType::SHORT() => 1, WallConnectionType::TALL() => 2, @@ -136,21 +148,21 @@ final class RuntimeDataWriter{ * @param BrewingStandSlot[] $slots * @phpstan-param array $slots */ - public function brewingStandSlots(array $slots) : void{ + public function brewingStandSlots(array &$slots) : void{ foreach([ BrewingStandSlot::EAST(), BrewingStandSlot::NORTHWEST(), BrewingStandSlot::SOUTHWEST(), ] as $member){ - $this->bool(isset($slots[$member->id()])); + $this->writeBool(isset($slots[$member->id()])); } } - public function railShape(int $railShape) : void{ + public function railShape(int &$railShape) : void{ $this->int(4, $railShape); } - public function straightOnlyRailShape(int $railShape) : void{ + public function straightOnlyRailShape(int &$railShape) : void{ $this->int(3, $railShape); } diff --git a/src/data/runtime/RuntimeEnumDescriber.php b/src/data/runtime/RuntimeEnumDescriber.php new file mode 100644 index 000000000..dc0083e8b --- /dev/null +++ b/src/data/runtime/RuntimeEnumDescriber.php @@ -0,0 +1,58 @@ +int(2, match($value){ + public function bellAttachmentType(\pocketmine\block\utils\BellAttachmentType &$value) : void{ + $this->writeInt(2, match($value){ \pocketmine\block\utils\BellAttachmentType::CEILING() => 0, \pocketmine\block\utils\BellAttachmentType::FLOOR() => 1, \pocketmine\block\utils\BellAttachmentType::ONE_WALL() => 2, @@ -41,8 +41,8 @@ trait RuntimeEnumSerializerTrait{ }); } - public function copperOxidation(\pocketmine\block\utils\CopperOxidation $value) : void{ - $this->int(2, match($value){ + public function copperOxidation(\pocketmine\block\utils\CopperOxidation &$value) : void{ + $this->writeInt(2, match($value){ \pocketmine\block\utils\CopperOxidation::EXPOSED() => 0, \pocketmine\block\utils\CopperOxidation::NONE() => 1, \pocketmine\block\utils\CopperOxidation::OXIDIZED() => 2, @@ -51,8 +51,8 @@ trait RuntimeEnumSerializerTrait{ }); } - public function coralType(\pocketmine\block\utils\CoralType $value) : void{ - $this->int(3, match($value){ + public function coralType(\pocketmine\block\utils\CoralType &$value) : void{ + $this->writeInt(3, match($value){ \pocketmine\block\utils\CoralType::BRAIN() => 0, \pocketmine\block\utils\CoralType::BUBBLE() => 1, \pocketmine\block\utils\CoralType::FIRE() => 2, @@ -62,8 +62,8 @@ trait RuntimeEnumSerializerTrait{ }); } - public function dirtType(\pocketmine\block\utils\DirtType $value) : void{ - $this->int(2, match($value){ + public function dirtType(\pocketmine\block\utils\DirtType &$value) : void{ + $this->writeInt(2, match($value){ \pocketmine\block\utils\DirtType::COARSE() => 0, \pocketmine\block\utils\DirtType::NORMAL() => 1, \pocketmine\block\utils\DirtType::ROOTED() => 2, @@ -71,8 +71,8 @@ trait RuntimeEnumSerializerTrait{ }); } - public function dyeColor(\pocketmine\block\utils\DyeColor $value) : void{ - $this->int(4, match($value){ + public function dyeColor(\pocketmine\block\utils\DyeColor &$value) : void{ + $this->writeInt(4, match($value){ \pocketmine\block\utils\DyeColor::BLACK() => 0, \pocketmine\block\utils\DyeColor::BLUE() => 1, \pocketmine\block\utils\DyeColor::BROWN() => 2, @@ -93,8 +93,8 @@ trait RuntimeEnumSerializerTrait{ }); } - public function froglightType(\pocketmine\block\utils\FroglightType $value) : void{ - $this->int(2, match($value){ + public function froglightType(\pocketmine\block\utils\FroglightType &$value) : void{ + $this->writeInt(2, match($value){ \pocketmine\block\utils\FroglightType::OCHRE() => 0, \pocketmine\block\utils\FroglightType::PEARLESCENT() => 1, \pocketmine\block\utils\FroglightType::VERDANT() => 2, @@ -102,8 +102,8 @@ trait RuntimeEnumSerializerTrait{ }); } - public function leverFacing(\pocketmine\block\utils\LeverFacing $value) : void{ - $this->int(3, match($value){ + public function leverFacing(\pocketmine\block\utils\LeverFacing &$value) : void{ + $this->writeInt(3, match($value){ \pocketmine\block\utils\LeverFacing::DOWN_AXIS_X() => 0, \pocketmine\block\utils\LeverFacing::DOWN_AXIS_Z() => 1, \pocketmine\block\utils\LeverFacing::EAST() => 2, @@ -116,8 +116,8 @@ trait RuntimeEnumSerializerTrait{ }); } - public function medicineType(\pocketmine\item\MedicineType $value) : void{ - $this->int(2, match($value){ + public function medicineType(\pocketmine\item\MedicineType &$value) : void{ + $this->writeInt(2, match($value){ \pocketmine\item\MedicineType::ANTIDOTE() => 0, \pocketmine\item\MedicineType::ELIXIR() => 1, \pocketmine\item\MedicineType::EYE_DROPS() => 2, @@ -126,8 +126,8 @@ trait RuntimeEnumSerializerTrait{ }); } - public function mushroomBlockType(\pocketmine\block\utils\MushroomBlockType $value) : void{ - $this->int(4, match($value){ + public function mushroomBlockType(\pocketmine\block\utils\MushroomBlockType &$value) : void{ + $this->writeInt(4, match($value){ \pocketmine\block\utils\MushroomBlockType::ALL_CAP() => 0, \pocketmine\block\utils\MushroomBlockType::CAP_EAST() => 1, \pocketmine\block\utils\MushroomBlockType::CAP_MIDDLE() => 2, @@ -143,8 +143,8 @@ trait RuntimeEnumSerializerTrait{ }); } - public function potionType(\pocketmine\item\PotionType $value) : void{ - $this->int(6, match($value){ + public function potionType(\pocketmine\item\PotionType &$value) : void{ + $this->writeInt(6, match($value){ \pocketmine\item\PotionType::AWKWARD() => 0, \pocketmine\item\PotionType::FIRE_RESISTANCE() => 1, \pocketmine\item\PotionType::HARMING() => 2, @@ -191,8 +191,8 @@ trait RuntimeEnumSerializerTrait{ }); } - public function skullType(\pocketmine\block\utils\SkullType $value) : void{ - $this->int(3, match($value){ + public function skullType(\pocketmine\block\utils\SkullType &$value) : void{ + $this->writeInt(3, match($value){ \pocketmine\block\utils\SkullType::CREEPER() => 0, \pocketmine\block\utils\SkullType::DRAGON() => 1, \pocketmine\block\utils\SkullType::PLAYER() => 2, @@ -203,8 +203,8 @@ trait RuntimeEnumSerializerTrait{ }); } - public function slabType(\pocketmine\block\utils\SlabType $value) : void{ - $this->int(2, match($value){ + public function slabType(\pocketmine\block\utils\SlabType &$value) : void{ + $this->writeInt(2, match($value){ \pocketmine\block\utils\SlabType::BOTTOM() => 0, \pocketmine\block\utils\SlabType::DOUBLE() => 1, \pocketmine\block\utils\SlabType::TOP() => 2, @@ -212,8 +212,8 @@ trait RuntimeEnumSerializerTrait{ }); } - public function suspiciousStewType(\pocketmine\item\SuspiciousStewType $value) : void{ - $this->int(4, match($value){ + public function suspiciousStewType(\pocketmine\item\SuspiciousStewType &$value) : void{ + $this->writeInt(4, match($value){ \pocketmine\item\SuspiciousStewType::ALLIUM() => 0, \pocketmine\item\SuspiciousStewType::AZURE_BLUET() => 1, \pocketmine\item\SuspiciousStewType::BLUE_ORCHID() => 2, diff --git a/src/item/Banner.php b/src/item/Banner.php index e86d4dbce..5de6bd909 100644 --- a/src/item/Banner.php +++ b/src/item/Banner.php @@ -29,8 +29,7 @@ use pocketmine\block\utils\BannerPatternLayer; use pocketmine\block\utils\DyeColor; use pocketmine\data\bedrock\BannerPatternTypeIdMap; use pocketmine\data\bedrock\DyeColorIdMap; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\nbt\NBT; use pocketmine\nbt\tag\CompoundTag; use pocketmine\nbt\tag\ListTag; @@ -64,7 +63,7 @@ class Banner extends ItemBlockWallOrFloor{ return $this; } - protected function describeType(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeType(RuntimeDataDescriber $w) : void{ $w->dyeColor($this->color); } diff --git a/src/item/CoralFan.php b/src/item/CoralFan.php index c3f23d2ca..7ea31d53d 100644 --- a/src/item/CoralFan.php +++ b/src/item/CoralFan.php @@ -27,8 +27,7 @@ use pocketmine\block\Block; use pocketmine\block\utils\CoralType; use pocketmine\block\utils\CoralTypeTrait; use pocketmine\block\VanillaBlocks; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\math\Axis; use pocketmine\math\Facing; @@ -42,7 +41,7 @@ final class CoralFan extends Item{ parent::__construct($identifier, VanillaBlocks::CORAL_FAN()->getName()); } - protected function describeType(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeType(RuntimeDataDescriber $w) : void{ //this is aliased to ensure a compile error in case the functions in Item or Block start to differ in future //right now we can directly reuse encodeType from CoralTypeTrait, but that might silently stop working if Item //were to be altered. CoralTypeTrait was originally intended for blocks, so it's better not to assume anything. diff --git a/src/item/Dye.php b/src/item/Dye.php index 4a32983d8..969c66eee 100644 --- a/src/item/Dye.php +++ b/src/item/Dye.php @@ -24,8 +24,7 @@ declare(strict_types=1); namespace pocketmine\item; use pocketmine\block\utils\DyeColor; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; class Dye extends Item{ private DyeColor $color; @@ -35,7 +34,7 @@ class Dye extends Item{ parent::__construct($identifier, $name); } - protected function describeType(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeType(RuntimeDataDescriber $w) : void{ $w->dyeColor($this->color); } diff --git a/src/item/Item.php b/src/item/Item.php index ded0de16b..ea2bd6125 100644 --- a/src/item/Item.php +++ b/src/item/Item.php @@ -32,7 +32,7 @@ use pocketmine\block\BlockToolType; use pocketmine\block\VanillaBlocks; use pocketmine\data\bedrock\EnchantmentIdMap; use pocketmine\data\bedrock\item\ItemTypeDeserializeException; -use pocketmine\data\runtime\RuntimeDataReader; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\data\runtime\RuntimeDataWriter; use pocketmine\data\SavedDataLoadingException; use pocketmine\entity\Entity; @@ -470,7 +470,7 @@ class Item implements \JsonSerializable{ return $writer->getValue(); } - protected function describeType(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeType(RuntimeDataDescriber $w) : void{ //NOOP } diff --git a/src/item/ItemBlock.php b/src/item/ItemBlock.php index 1a005286d..a7e14b5ce 100644 --- a/src/item/ItemBlock.php +++ b/src/item/ItemBlock.php @@ -26,8 +26,7 @@ namespace pocketmine\item; use pocketmine\block\Block; use pocketmine\block\RuntimeBlockStateRegistry; use pocketmine\block\VanillaBlocks; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; /** * Class used for Items that directly represent blocks, such as stone, dirt, wood etc. @@ -53,7 +52,7 @@ final class ItemBlock extends Item{ $this->maxStackSize = $block->getMaxStackSize(); } - protected function describeType(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeType(RuntimeDataDescriber $w) : void{ $w->int(Block::INTERNAL_STATE_DATA_BITS, $this->blockTypeData); } diff --git a/src/item/Medicine.php b/src/item/Medicine.php index 0915a19c1..099af6d3c 100644 --- a/src/item/Medicine.php +++ b/src/item/Medicine.php @@ -23,8 +23,7 @@ declare(strict_types=1); namespace pocketmine\item; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\entity\Living; use pocketmine\player\Player; @@ -37,7 +36,7 @@ class Medicine extends Item implements ConsumableItem{ parent::__construct($identifier, $name); } - protected function describeType(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeType(RuntimeDataDescriber $w) : void{ $w->medicineType($this->medicineType); } diff --git a/src/item/Potion.php b/src/item/Potion.php index 1933c9909..7fcbeaa04 100644 --- a/src/item/Potion.php +++ b/src/item/Potion.php @@ -23,8 +23,7 @@ declare(strict_types=1); namespace pocketmine\item; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\entity\Living; use pocketmine\player\Player; @@ -37,7 +36,7 @@ class Potion extends Item implements ConsumableItem{ parent::__construct($identifier, $name); } - protected function describeType(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeType(RuntimeDataDescriber $w) : void{ $w->potionType($this->potionType); } diff --git a/src/item/SplashPotion.php b/src/item/SplashPotion.php index 462b670b3..a99d7541d 100644 --- a/src/item/SplashPotion.php +++ b/src/item/SplashPotion.php @@ -23,8 +23,7 @@ declare(strict_types=1); namespace pocketmine\item; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; use pocketmine\entity\Location; use pocketmine\entity\projectile\SplashPotion as SplashPotionEntity; use pocketmine\entity\projectile\Throwable; @@ -39,7 +38,7 @@ class SplashPotion extends ProjectileItem{ parent::__construct($identifier, $name); } - protected function describeType(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeType(RuntimeDataDescriber $w) : void{ $w->potionType($this->potionType); } diff --git a/src/item/SuspiciousStew.php b/src/item/SuspiciousStew.php index 8f5eb3e2d..1ecb94d7b 100644 --- a/src/item/SuspiciousStew.php +++ b/src/item/SuspiciousStew.php @@ -23,8 +23,7 @@ declare(strict_types=1); namespace pocketmine\item; -use pocketmine\data\runtime\RuntimeDataReader; -use pocketmine\data\runtime\RuntimeDataWriter; +use pocketmine\data\runtime\RuntimeDataDescriber; class SuspiciousStew extends Food{ @@ -35,7 +34,7 @@ class SuspiciousStew extends Food{ parent::__construct($identifier, $name); } - protected function describeType(RuntimeDataReader|RuntimeDataWriter $w) : void{ + protected function describeType(RuntimeDataDescriber $w) : void{ $w->suspiciousStewType($this->suspiciousStewType); }