mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-05 09:39:56 +00:00
"Fixed" FloatingTextParticle yet again
- nametag visibility flags don't work properly, only players show them all the time - invisibility overrides nametag visibility - scale 0 triggers asserts on debug builds ..... how hard is it to NOT break these simple things each update Mojang? closes #1205
This commit is contained in:
parent
10f6a0eef0
commit
9bd7f771d3
@ -25,9 +25,13 @@ namespace pocketmine\level\particle;
|
|||||||
|
|
||||||
use pocketmine\entity\Entity;
|
use pocketmine\entity\Entity;
|
||||||
use pocketmine\entity\Item as ItemEntity;
|
use pocketmine\entity\Item as ItemEntity;
|
||||||
|
use pocketmine\item\Item;
|
||||||
|
use pocketmine\item\ItemFactory;
|
||||||
use pocketmine\math\Vector3;
|
use pocketmine\math\Vector3;
|
||||||
use pocketmine\network\mcpe\protocol\AddEntityPacket;
|
use pocketmine\network\mcpe\protocol\AddEntityPacket;
|
||||||
|
use pocketmine\network\mcpe\protocol\AddPlayerPacket;
|
||||||
use pocketmine\network\mcpe\protocol\RemoveEntityPacket;
|
use pocketmine\network\mcpe\protocol\RemoveEntityPacket;
|
||||||
|
use pocketmine\utils\UUID;
|
||||||
|
|
||||||
class FloatingTextParticle extends Particle{
|
class FloatingTextParticle extends Particle{
|
||||||
//TODO: HACK!
|
//TODO: HACK!
|
||||||
@ -77,13 +81,13 @@ class FloatingTextParticle extends Particle{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!$this->invisible){
|
if(!$this->invisible){
|
||||||
|
$pk = new AddPlayerPacket();
|
||||||
$pk = new AddEntityPacket();
|
$pk->uuid = UUID::fromRandom();
|
||||||
|
$pk->username = "";
|
||||||
$pk->entityRuntimeId = $this->entityId;
|
$pk->entityRuntimeId = $this->entityId;
|
||||||
$pk->type = ItemEntity::NETWORK_ID;
|
$pk->position = $this->asVector3(); //TODO: check offset
|
||||||
$pk->position = $this->asVector3()->subtract(0, 0.75, 0);
|
$pk->item = ItemFactory::get(Item::AIR, 0, 0);
|
||||||
$pk->yaw = 0;
|
|
||||||
$pk->pitch = 0;
|
|
||||||
$flags = (
|
$flags = (
|
||||||
(1 << Entity::DATA_FLAG_CAN_SHOW_NAMETAG) |
|
(1 << Entity::DATA_FLAG_CAN_SHOW_NAMETAG) |
|
||||||
(1 << Entity::DATA_FLAG_ALWAYS_SHOW_NAMETAG) |
|
(1 << Entity::DATA_FLAG_ALWAYS_SHOW_NAMETAG) |
|
||||||
@ -91,7 +95,8 @@ class FloatingTextParticle extends Particle{
|
|||||||
);
|
);
|
||||||
$pk->metadata = [
|
$pk->metadata = [
|
||||||
Entity::DATA_FLAGS => [Entity::DATA_TYPE_LONG, $flags],
|
Entity::DATA_FLAGS => [Entity::DATA_TYPE_LONG, $flags],
|
||||||
Entity::DATA_NAMETAG => [Entity::DATA_TYPE_STRING, $this->title . ($this->text !== "" ? "\n" . $this->text : "")]
|
Entity::DATA_NAMETAG => [Entity::DATA_TYPE_STRING, $this->title . ($this->text !== "" ? "\n" . $this->text : "")],
|
||||||
|
Entity::DATA_SCALE => [Entity::DATA_TYPE_FLOAT, 0.01] //zero causes problems on debug builds
|
||||||
];
|
];
|
||||||
|
|
||||||
$p[] = $pk;
|
$p[] = $pk;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user