Skip to content

InfestedEffect 5.47.0 ​

class · pocketmine\entity\effect\InfestedEffect · source

Extends Effect
Implements DamageAwareEffect

Infested (https://minecraft.wiki/w/Infested): each time the entity is hurt there is a 10% chance that 1-2 silverfish come out of it, halfway up its body, pushed out in front of it (Java InfestedMobEffect: look direction x0.3, 1.5x upwards, turned by a random angle up to 90 degrees). The amplifier doesn't change the chance or the count. Nothing spawns in peaceful, where silverfish despawn. Silverfish themselves are immune to it, so they never chain.

Constants ​

SPAWN_CHANCE ​

php
public const SPAWN_CHANCE = 0.1

Methods ​

onEntityDamaged() ​

php
public function onEntityDamaged(\pocketmine\entity\Living $entity, \pocketmine\entity\effect\EffectInstance $instance, \pocketmine\event\entity\EntityDamageEvent $source) : void

rollSilverfishCount() ​

php
public static function rollSilverfishCount() : int

Returns how many silverfish one hit lets out: 0 (90%), 1 or 2.

spawnSilverfish() ​

php
public static function spawnSilverfish(\pocketmine\entity\Living $entity, int $count) : array

Spawns the given number of silverfish out of the entity and returns them (none in peaceful).

VanillaMine is a fork of PocketMine-MP. Not affiliated with the PMMP team or Mojang.