Skip to content

Commit

Permalink
add pmmp#5122
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshy3282 committed Oct 1, 2024
1 parent 18fa41c commit cf62b4f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Additions
> https://github.com/pmmp/PocketMine-MP/pull/4687
> https://github.com/pmmp/PocketMine-MP/pull/4715
> https://github.com/pmmp/PocketMine-MP/pull/4742
> https://github.com/pmmp/PocketMine-MP/pull/5095
> https://github.com/pmmp/PocketMine-MP/pull/5122

## What is this?
Expand Down
4 changes: 4 additions & 0 deletions src/entity/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,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 @@ -492,6 +493,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 @@ -520,6 +522,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

0 comments on commit cf62b4f

Please sign in to comment.