mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +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){
|
switch($this->id){
|
||||||
case Effect::INVISIBILITY:
|
case Effect::INVISIBILITY:
|
||||||
$entity->setGenericFlag(Entity::DATA_FLAG_INVISIBLE, true);
|
$entity->setInvisible();
|
||||||
$entity->setNameTagVisible(false);
|
$entity->setNameTagVisible(false);
|
||||||
break;
|
break;
|
||||||
case Effect::SPEED:
|
case Effect::SPEED:
|
||||||
@ -466,7 +466,7 @@ class Effect{
|
|||||||
|
|
||||||
switch($this->id){
|
switch($this->id){
|
||||||
case Effect::INVISIBILITY:
|
case Effect::INVISIBILITY:
|
||||||
$entity->setGenericFlag(Entity::DATA_FLAG_INVISIBLE, false);
|
$entity->setInvisible(false);
|
||||||
$entity->setNameTagVisible(true);
|
$entity->setNameTagVisible(true);
|
||||||
break;
|
break;
|
||||||
case Effect::SPEED:
|
case Effect::SPEED:
|
||||||
|
@ -655,6 +655,14 @@ abstract class Entity extends Location implements Metadatable, EntityIds{
|
|||||||
$this->setGenericFlag(self::DATA_FLAG_IMMOBILE, $value);
|
$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.
|
* Returns whether the entity is able to climb blocks such as ladders or vines.
|
||||||
* @return bool
|
* @return bool
|
||||||
|
Loading…
x
Reference in New Issue
Block a user