Allow setting nametag for any kind of entity

This commit is contained in:
Shoghi Cervantes
2015-05-18 13:08:06 +02:00
parent fbbe02a3bc
commit 85c43ba011
5 changed files with 12 additions and 15 deletions

View File

@ -2220,6 +2220,9 @@ class Level implements ChunkManager, Metadatable{
}
if($entity instanceof Player){
$this->players[$entity->getId()] = $entity;
}else{
$entity->setDataProperty(Entity::DATA_NAMETAG, Entity::DATA_TYPE_STRING, (new \ReflectionObject($entity))->getShortName());
$entity->setDataProperty(Entity::DATA_SHOW_NAMETAG, Entity::DATA_TYPE_BYTE, 1);
}
$this->entities[$entity->getId()] = $entity;
}