mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-06 11:57:10 +00:00
Add API methods: Entity::isInvisible(), Entity::setInvisible() (#1930)
* Make use of the API function in Effect class
This commit is contained in:
parent
7a5e5773b7
commit
beb5bf6dda
@ -423,7 +423,7 @@ class Effect{
|
||||
|
||||
switch($this->id){
|
||||
case Effect::INVISIBILITY:
|
||||
$entity->setGenericFlag(Entity::DATA_FLAG_INVISIBLE, true);
|
||||
$entity->setInvisible();
|
||||
$entity->setNameTagVisible(false);
|
||||
break;
|
||||
case Effect::SPEED:
|
||||
@ -466,7 +466,7 @@ class Effect{
|
||||
|
||||
switch($this->id){
|
||||
case Effect::INVISIBILITY:
|
||||
$entity->setGenericFlag(Entity::DATA_FLAG_INVISIBLE, false);
|
||||
$entity->setInvisible(false);
|
||||
$entity->setNameTagVisible(true);
|
||||
break;
|
||||
case Effect::SPEED:
|
||||
|
@ -655,6 +655,14 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
||||
$this->setGenericFlag(self::DATA_FLAG_IMMOBILE, $value);
|
||||
}
|
||||
|
||||
public function isInvisible() : bool{
|
||||
return $this->getGenericFlag(self::DATA_FLAG_INVISIBLE);
|
||||
}
|
||||
|
||||
public function setInvisible(bool $value = true) : void{
|
||||
$this->setGenericFlag(self::DATA_FLAG_INVISIBLE, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the entity is able to climb blocks such as ladders or vines.
|
||||
* @return bool
|
||||
|
Loading…
x
Reference in New Issue
Block a user