You can use my api extracted from Texter plugin. PHP: /** @var Vector3 $vector3 */$eid = FloatingTextApi::createText($vector3);/** @var Player $player */FloatingTextApi::sendText($eid, $player, "My awesome floating text");
hey im using your api for a plugin which displays names over dropped items kinda need some help i just dont know what to do with the Api sendText Method And How it works This What My Current Code Looks Like PHP: public function onDrop(PlayerDropItemEvent $e, $FloatingTextApi) { $grounditem = $e->getItem(); $itemname = $e->getItem()->getName(); $player = $e->getPlayer(); $pos = $player->getPosition(); $text = $itemname; // Spawning text $textId = FloatingTextApi::createText(new vector3($pos)); // $vector3 -> position of floating text, This function is just for initialize FloatingTextApi::sendText($eId, $player ("{$text}\n{$text}")); // This you can use to spawn text, and for update too }
You can treat it like Particles, thanks to PMMP's HACK which treats entities as particles. PHP: <?phpdeclare(strict_types=1);use pocketmine\level\Level;use pocketmine\level\particle\FloatingTextParticle;use pocketmine\math\Vector3;//Create/** @var Vector3 $pos */$particle = new FloatingTextParticle($pos, "test\nfoo\nhoge", "Title!");//Create the particle/** @var Level $level */$level->addParticle($particle);//Spawn to level//Update$particle->setTitle("Updated title!");$particle->setText("Updated text!");/** @var Level $level */$level->addParticle($particle);//Spawn to level//Remove$particle->setInvisible(true);//Set remove$level->addParticle($particle);//Remove!