mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
phpdoc armageddon for master, pass 1
This commit is contained in:
@ -57,7 +57,6 @@ class Effect{
|
||||
|
||||
/**
|
||||
* Returns the effect ID as per Minecraft PE
|
||||
* @return int
|
||||
*/
|
||||
public function getId() : int{
|
||||
return $this->id;
|
||||
@ -65,7 +64,6 @@ class Effect{
|
||||
|
||||
/**
|
||||
* Returns the translation key used to translate this effect's name.
|
||||
* @return string
|
||||
*/
|
||||
public function getName() : string{
|
||||
return $this->name;
|
||||
@ -73,7 +71,6 @@ class Effect{
|
||||
|
||||
/**
|
||||
* Returns a Color object representing this effect's particle colour.
|
||||
* @return Color
|
||||
*/
|
||||
public function getColor() : Color{
|
||||
return $this->color;
|
||||
@ -82,8 +79,6 @@ class Effect{
|
||||
/**
|
||||
* Returns whether this effect is harmful.
|
||||
* TODO: implement inverse effect results for undead mobs
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isBad() : bool{
|
||||
return $this->bad;
|
||||
@ -91,7 +86,6 @@ class Effect{
|
||||
|
||||
/**
|
||||
* Returns the default duration (in ticks) this effect will apply for if a duration is not specified.
|
||||
* @return int
|
||||
*/
|
||||
public function getDefaultDuration() : int{
|
||||
return 600;
|
||||
@ -99,7 +93,6 @@ class Effect{
|
||||
|
||||
/**
|
||||
* Returns whether this effect will give the subject potion bubbles.
|
||||
* @return bool
|
||||
*/
|
||||
public function hasBubbles() : bool{
|
||||
return $this->hasBubbles;
|
||||
@ -107,10 +100,6 @@ class Effect{
|
||||
|
||||
/**
|
||||
* Returns whether the effect will do something on the current tick.
|
||||
*
|
||||
* @param EffectInstance $instance
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function canTick(EffectInstance $instance) : bool{
|
||||
return false;
|
||||
@ -118,11 +107,6 @@ class Effect{
|
||||
|
||||
/**
|
||||
* Applies effect results to an entity. This will not be called unless canTick() returns true.
|
||||
*
|
||||
* @param Living $entity
|
||||
* @param EffectInstance $instance
|
||||
* @param float $potency
|
||||
* @param null|Entity $source
|
||||
*/
|
||||
public function applyEffect(Living $entity, EffectInstance $instance, float $potency = 1.0, ?Entity $source = null) : void{
|
||||
|
||||
@ -130,9 +114,6 @@ class Effect{
|
||||
|
||||
/**
|
||||
* Applies effects to the entity when the effect is first added.
|
||||
*
|
||||
* @param Living $entity
|
||||
* @param EffectInstance $instance
|
||||
*/
|
||||
public function add(Living $entity, EffectInstance $instance) : void{
|
||||
|
||||
@ -140,9 +121,6 @@ class Effect{
|
||||
|
||||
/**
|
||||
* Removes the effect from the entity, resetting any changed values back to their original defaults.
|
||||
*
|
||||
* @param Living $entity
|
||||
* @param EffectInstance $instance
|
||||
*/
|
||||
public function remove(Living $entity, EffectInstance $instance) : void{
|
||||
|
||||
|
@ -47,12 +47,7 @@ class EffectInstance{
|
||||
private $color;
|
||||
|
||||
/**
|
||||
* @param Effect $effectType
|
||||
* @param int|null $duration Passing null will use the effect type's default duration
|
||||
* @param int $amplifier
|
||||
* @param bool $visible
|
||||
* @param bool $ambient
|
||||
* @param null|Color $overrideColor
|
||||
*/
|
||||
public function __construct(Effect $effectType, ?int $duration = null, int $amplifier = 0, bool $visible = true, bool $ambient = false, ?Color $overrideColor = null){
|
||||
$this->effectType = $effectType;
|
||||
@ -67,17 +62,12 @@ class EffectInstance{
|
||||
return $this->effectType->getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Effect
|
||||
*/
|
||||
public function getType() : Effect{
|
||||
return $this->effectType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of ticks remaining until the effect expires.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getDuration() : int{
|
||||
return $this->duration;
|
||||
@ -86,8 +76,6 @@ class EffectInstance{
|
||||
/**
|
||||
* Sets the number of ticks remaining until the effect expires.
|
||||
*
|
||||
* @param int $duration
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*
|
||||
* @return $this
|
||||
@ -104,8 +92,6 @@ class EffectInstance{
|
||||
/**
|
||||
* Decreases the duration by the given number of ticks, without dropping below zero.
|
||||
*
|
||||
* @param int $ticks
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function decreaseDuration(int $ticks) : EffectInstance{
|
||||
@ -116,32 +102,23 @@ class EffectInstance{
|
||||
|
||||
/**
|
||||
* Returns whether the duration has run out.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasExpired() : bool{
|
||||
return $this->duration <= 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getAmplifier() : int{
|
||||
return $this->amplifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the level of this effect, which is always one higher than the amplifier.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getEffectLevel() : int{
|
||||
return $this->amplifier + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $amplifier
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAmplifier(int $amplifier) : EffectInstance{
|
||||
@ -155,16 +132,12 @@ class EffectInstance{
|
||||
|
||||
/**
|
||||
* Returns whether this effect will produce some visible effect, such as bubbles or particles.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isVisible() : bool{
|
||||
return $this->visible;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $visible
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setVisible(bool $visible = true) : EffectInstance{
|
||||
@ -177,16 +150,12 @@ class EffectInstance{
|
||||
* Returns whether the effect originated from the ambient environment.
|
||||
* Ambient effects can originate from things such as a Beacon's area of effect radius.
|
||||
* If this flag is set, the amount of visible particles will be reduced by a factor of 5.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isAmbient() : bool{
|
||||
return $this->ambient;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $ambient
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAmbient(bool $ambient = true) : EffectInstance{
|
||||
@ -198,8 +167,6 @@ class EffectInstance{
|
||||
/**
|
||||
* Returns the particle colour of this effect instance. This can be overridden on a per-EffectInstance basis, so it
|
||||
* is not reflective of the default colour of the effect.
|
||||
*
|
||||
* @return Color
|
||||
*/
|
||||
public function getColor() : Color{
|
||||
return $this->color;
|
||||
@ -207,10 +174,6 @@ class EffectInstance{
|
||||
|
||||
/**
|
||||
* Sets the colour of this EffectInstance.
|
||||
*
|
||||
* @param Color $color
|
||||
*
|
||||
* @return EffectInstance
|
||||
*/
|
||||
public function setColor(Color $color) : EffectInstance{
|
||||
$this->color = $color;
|
||||
@ -220,8 +183,6 @@ class EffectInstance{
|
||||
|
||||
/**
|
||||
* Resets the colour of this EffectInstance to the default specified by its type.
|
||||
*
|
||||
* @return EffectInstance
|
||||
*/
|
||||
public function resetColor() : EffectInstance{
|
||||
$this->color = $this->effectType->getColor();
|
||||
|
@ -73,8 +73,6 @@ class EffectManager{
|
||||
|
||||
/**
|
||||
* Removes the effect with the specified ID from the mob.
|
||||
*
|
||||
* @param Effect $effectType
|
||||
*/
|
||||
public function remove(Effect $effectType) : void{
|
||||
$index = $effectType->getId();
|
||||
@ -105,10 +103,6 @@ class EffectManager{
|
||||
/**
|
||||
* Returns the effect instance active on this entity with the specified ID, or null if the mob does not have the
|
||||
* effect.
|
||||
*
|
||||
* @param Effect $effect
|
||||
*
|
||||
* @return EffectInstance|null
|
||||
*/
|
||||
public function get(Effect $effect) : ?EffectInstance{
|
||||
return $this->effects[$effect->getId()] ?? null;
|
||||
@ -116,10 +110,6 @@ class EffectManager{
|
||||
|
||||
/**
|
||||
* Returns whether the specified effect is active on the mob.
|
||||
*
|
||||
* @param Effect $effect
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function has(Effect $effect) : bool{
|
||||
return isset($this->effects[$effect->getId()]);
|
||||
@ -130,8 +120,6 @@ class EffectManager{
|
||||
* If a weaker effect of the same type is already applied, it will be replaced.
|
||||
* If a weaker or equal-strength effect is already applied but has a shorter duration, it will be replaced.
|
||||
*
|
||||
* @param EffectInstance $effect
|
||||
*
|
||||
* @return bool whether the effect has been successfully applied.
|
||||
*/
|
||||
public function add(EffectInstance $effect) : bool{
|
||||
@ -203,16 +191,10 @@ class EffectManager{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Color
|
||||
*/
|
||||
public function getBubbleColor() : Color{
|
||||
return $this->bubbleColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function hasOnlyAmbientEffects() : bool{
|
||||
return $this->onlyAmbientEffects;
|
||||
}
|
||||
|
@ -104,11 +104,6 @@ final class VanillaEffects{
|
||||
self::$mcpeIdMap[$member->getId()] = $member;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
*
|
||||
* @return Effect|null
|
||||
*/
|
||||
public static function byMcpeId(int $id) : ?Effect{
|
||||
self::checkInit();
|
||||
return self::$mcpeIdMap[$id] ?? null;
|
||||
@ -121,11 +116,6 @@ final class VanillaEffects{
|
||||
return self::_registryGetAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*
|
||||
* @return Effect
|
||||
*/
|
||||
public static function fromString(string $name) : Effect{
|
||||
$result = self::_registryFromString($name);
|
||||
assert($result instanceof Effect);
|
||||
|
Reference in New Issue
Block a user