Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/entity/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ abstract class Entity{
private const TAG_FALL_DISTANCE = "FallDistance"; //TAG_Float
private const TAG_CUSTOM_NAME = "CustomName"; //TAG_String
private const TAG_CUSTOM_NAME_VISIBLE = "CustomNameVisible"; //TAG_Byte
private const TAG_CUSTOM_NAME_ALWAYS_VISIBLE = "CustomNameAlwaysVisible"; //TAG_Byte
public const TAG_POS = "Pos"; //TAG_List<TAG_Double>|TAG_List<TAG_Float>
public const TAG_MOTION = "Motion"; //TAG_List<TAG_Double>|TAG_List<TAG_Float>
public const TAG_ROTATION = "Rotation"; //TAG_List<TAG_Float>
Expand Down Expand Up @@ -483,6 +484,7 @@ public function saveNBT() : CompoundTag{
if($this->getNameTag() !== ""){
$nbt->setString(self::TAG_CUSTOM_NAME, $this->getNameTag());
$nbt->setByte(self::TAG_CUSTOM_NAME_VISIBLE, $this->isNameTagVisible() ? 1 : 0);
$nbt->setByte(self::TAG_CUSTOM_NAME_ALWAYS_VISIBLE, $this->isNameTagAlwaysVisible() ? 1 : 0);
}
}

Expand Down Expand Up @@ -511,6 +513,8 @@ protected function initEntity(CompoundTag $nbt) : void{
}else{
$this->setNameTagVisible($nbt->getByte(self::TAG_CUSTOM_NAME_VISIBLE, 1) !== 0);
}

$this->setNameTagAlwaysVisible($nbt->getByte(self::TAG_CUSTOM_NAME_ALWAYS_VISIBLE, 0) !== 0);
}
}

Expand Down