mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-05 11:27:07 +00:00
Added interface RuntimeDataDescriber
This commit is contained in:
parent
ceff230d73
commit
c2f6d8139a
@ -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<string, list<string>> $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";
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
67
src/data/runtime/RuntimeDataDescriber.php
Normal file
67
src/data/runtime/RuntimeDataDescriber.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\runtime;
|
||||
|
||||
use pocketmine\block\utils\BrewingStandSlot;
|
||||
use pocketmine\block\utils\WallConnectionType;
|
||||
use pocketmine\math\Facing;
|
||||
|
||||
interface RuntimeDataDescriber extends RuntimeEnumDescriber{
|
||||
public function int(int $bits, int &$value) : void;
|
||||
|
||||
public function boundedInt(int $bits, int $min, int $max, int &$value) : void;
|
||||
|
||||
public function bool(bool &$value) : void;
|
||||
|
||||
public function horizontalFacing(int &$facing) : void;
|
||||
|
||||
/**
|
||||
* @param int[] $faces
|
||||
*/
|
||||
public function horizontalFacingFlags(array &$faces) : void;
|
||||
|
||||
public function facing(int &$facing) : void;
|
||||
|
||||
public function facingExcept(int &$facing, int $except) : void;
|
||||
|
||||
public function axis(int &$axis) : void;
|
||||
|
||||
public function horizontalAxis(int &$axis) : void;
|
||||
|
||||
/**
|
||||
* @param WallConnectionType[] $connections
|
||||
* @phpstan-param array<Facing::NORTH|Facing::EAST|Facing::SOUTH|Facing::WEST, WallConnectionType> $connections
|
||||
*/
|
||||
public function wallConnections(array &$connections) : void;
|
||||
|
||||
/**
|
||||
* @param BrewingStandSlot[] $slots
|
||||
* @phpstan-param array<int, BrewingStandSlot> $slots
|
||||
*/
|
||||
public function brewingStandSlots(array &$slots) : void;
|
||||
|
||||
public function railShape(int &$railShape) : void;
|
||||
|
||||
public function straightOnlyRailShape(int &$railShape) : void;
|
||||
}
|
@ -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(),
|
||||
|
@ -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<Facing::NORTH|Facing::EAST|Facing::SOUTH|Facing::WEST, WallConnectionType> $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<int, BrewingStandSlot> $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);
|
||||
}
|
||||
|
||||
|
58
src/data/runtime/RuntimeEnumDescriber.php
Normal file
58
src/data/runtime/RuntimeEnumDescriber.php
Normal file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
*
|
||||
* ____ _ _ __ __ _ __ __ ____
|
||||
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
|
||||
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
|
||||
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
|
||||
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* @author PocketMine Team
|
||||
* @link http://www.pocketmine.net/
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace pocketmine\data\runtime;
|
||||
|
||||
/**
|
||||
* This class is auto-generated. Do not edit it manually.
|
||||
* @see build/generate-runtime-enum-serializers.php
|
||||
*/
|
||||
interface RuntimeEnumDescriber{
|
||||
|
||||
public function bellAttachmentType(\pocketmine\block\utils\BellAttachmentType &$value) : void;
|
||||
|
||||
public function copperOxidation(\pocketmine\block\utils\CopperOxidation &$value) : void;
|
||||
|
||||
public function coralType(\pocketmine\block\utils\CoralType &$value) : void;
|
||||
|
||||
public function dirtType(\pocketmine\block\utils\DirtType &$value) : void;
|
||||
|
||||
public function dyeColor(\pocketmine\block\utils\DyeColor &$value) : void;
|
||||
|
||||
public function froglightType(\pocketmine\block\utils\FroglightType &$value) : void;
|
||||
|
||||
public function leverFacing(\pocketmine\block\utils\LeverFacing &$value) : void;
|
||||
|
||||
public function medicineType(\pocketmine\item\MedicineType &$value) : void;
|
||||
|
||||
public function mushroomBlockType(\pocketmine\block\utils\MushroomBlockType &$value) : void;
|
||||
|
||||
public function potionType(\pocketmine\item\PotionType &$value) : void;
|
||||
|
||||
public function skullType(\pocketmine\block\utils\SkullType &$value) : void;
|
||||
|
||||
public function slabType(\pocketmine\block\utils\SlabType &$value) : void;
|
||||
|
||||
public function suspiciousStewType(\pocketmine\item\SuspiciousStewType &$value) : void;
|
||||
|
||||
}
|
@ -29,10 +29,10 @@ namespace pocketmine\data\runtime;
|
||||
*/
|
||||
trait RuntimeEnumSerializerTrait{
|
||||
|
||||
abstract public function int(int $bits, int $value) : void;
|
||||
abstract protected function writeInt(int $bits, int $value) : void;
|
||||
|
||||
public function bellAttachmentType(\pocketmine\block\utils\BellAttachmentType $value) : void{
|
||||
$this->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,
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user