diff --git a/.poggit.yml b/.poggit.yml index c346acf..d54fbaf 100644 --- a/.poggit.yml +++ b/.poggit.yml @@ -7,5 +7,6 @@ projects: path: "" libs: - src: poggit/libasynql/libasynql - version: 4.1.6 + branch: pm5 + version: ^4.1.1 ... diff --git a/plugin.yml b/plugin.yml index 1286c3c..2494e50 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,7 +1,7 @@ name: FloatingText main: cosmicpe\floatingtext\Loader -api: 4.0.0 -version: 0.1.1 +api: 5.0.0 +version: 0.1.2 commands: floatingtext: aliases: [ft] diff --git a/src/cosmicpe/floatingtext/FloatingText.php b/src/cosmicpe/floatingtext/FloatingText.php index bda5432..b976690 100644 --- a/src/cosmicpe/floatingtext/FloatingText.php +++ b/src/cosmicpe/floatingtext/FloatingText.php @@ -7,10 +7,10 @@ final class FloatingText{ public function __construct( - /** @readonly */ public string $world, - /** @readonly */ public float $x, - /** @readonly */ public float $y, - /** @readonly */ public float $z, - /** @readonly */ public string $line + readonly public string $world, + readonly public float $x, + readonly public float $y, + readonly public float $z, + readonly public string $line ){} } \ No newline at end of file diff --git a/src/cosmicpe/floatingtext/FloatingTextEntity.php b/src/cosmicpe/floatingtext/FloatingTextEntity.php index 13f8c7b..4455e02 100644 --- a/src/cosmicpe/floatingtext/FloatingTextEntity.php +++ b/src/cosmicpe/floatingtext/FloatingTextEntity.php @@ -12,7 +12,7 @@ use pocketmine\event\entity\EntityDamageEvent; use pocketmine\math\Vector3; use pocketmine\nbt\tag\CompoundTag; -use pocketmine\network\mcpe\convert\RuntimeBlockMapping; +use pocketmine\network\mcpe\convert\TypeConverter; use pocketmine\network\mcpe\protocol\types\entity\EntityIds; use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataCollection; use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataProperties; @@ -24,13 +24,6 @@ public static function getNetworkTypeId() : string{ return EntityIds::FALLING_BLOCK; } - public $gravity = 0.0; - public $canCollide = false; - public $keepMovement = true; - protected $gravityEnabled = false; - protected $drag = 0.0; - protected $immobile = true; - private int $floating_text_id; private FloatingText $floating_text; @@ -41,13 +34,18 @@ public function __construct(World $world, int $text_id, FloatingText $text){ $this->setCanSaveWithChunk(false); $this->floating_text_id = $text_id; $this->floating_text = $text; + $this->keepMovement = true; + $this->gravity = 0.0; + $this->gravityEnabled = false; + $this->drag = 0.0; + $this->noClientPredictions = true; parent::__construct(new Location($text->x, $text->y, $text->z, $world, 0.0, 0.0)); } protected function initEntity(CompoundTag $nbt) : void{ parent::initEntity($nbt); $this->setNameTag($this->floating_text->line); - $this->setNameTagAlwaysVisible(true); + $this->setNameTagAlwaysVisible(); } protected function getInitialSizeInfo() : EntitySizeInfo{ @@ -56,7 +54,7 @@ protected function getInitialSizeInfo() : EntitySizeInfo{ protected function syncNetworkData(EntityMetadataCollection $properties) : void{ parent::syncNetworkData($properties); - $properties->setInt(EntityMetadataProperties::VARIANT, RuntimeBlockMapping::getInstance()->toRuntimeId(VanillaBlocks::AIR()->getFullId())); + $properties->setInt(EntityMetadataProperties::VARIANT, TypeConverter::getInstance()->getBlockTranslator()->internalIdToNetworkId(VanillaBlocks::AIR()->getStateId())); } public function addDespawnCallback(Closure $callback) : void{ @@ -90,6 +88,14 @@ public function canBeMovedByCurrents() : bool{ return false; } + protected function getInitialDragMultiplier() : float{ + return 0.0; + } + + protected function getInitialGravity() : float{ + return 0.0; + } + public function getOffsetPosition(Vector3 $vector3) : Vector3{ return parent::getOffsetPosition($vector3)->add(0.0, 0.49, 0.0); }