88 protected const DEFAULT_BREATH_TICKS = 300;
101 private const TAG_LEGACY_HEALTH =
"HealF";
102 private const TAG_HEALTH =
"Health";
103 private const TAG_BREATH_TICKS =
"Air";
104 private const TAG_ACTIVE_EFFECTS =
"ActiveEffects";
105 private const TAG_EFFECT_ID =
"Id";
106 private const TAG_EFFECT_DURATION =
"Duration";
107 private const TAG_EFFECT_AMPLIFIER =
"Amplifier";
108 private const TAG_EFFECT_SHOW_PARTICLES =
"ShowParticles";
109 private const TAG_EFFECT_AMBIENT =
"Ambient";
111 protected int $attackTime = 0;
113 public int $deadTicks = 0;
114 protected int $maxDeadTicks = 25;
116 protected float $jumpVelocity = 0.42;
122 protected bool $breathing =
true;
123 protected int $breathTicks = self::DEFAULT_BREATH_TICKS;
124 protected int $maxBreathTicks = self::DEFAULT_BREATH_TICKS;
128 protected Attribute $knockbackResistanceAttr;
131 protected bool $sprinting =
false;
132 protected bool $sneaking =
false;
133 protected bool $gliding =
false;
134 protected bool $swimming =
false;
136 private ?
int $frostWalkerLevel =
null;
142 abstract public function getName() : string;
148 protected function initEntity(
CompoundTag $nbt) : void{
149 parent::initEntity($nbt);
152 $this->effectManager->getEffectAddHooks()->add(
function() :
void{ $this->networkPropertiesDirty =
true; });
153 $this->effectManager->getEffectRemoveHooks()->add(
function() :
void{ $this->networkPropertiesDirty =
true; });
155 $this->armorInventory =
new ArmorInventory();
157 $this->armorInventory->getListeners()->add(CallbackInventoryListener::onAnyChange(fn() => NetworkBroadcastUtils::broadcastEntityEvent(
159 fn(EntityEventBroadcaster $broadcaster, array $recipients) => $broadcaster->onMobArmorChange($recipients, $this)
161 $this->armorInventory->getListeners()->add(
new CallbackInventoryListener(
162 onSlotChange:
function(Inventory $inventory,
int $slot) :
void{
163 if($slot === ArmorInventory::SLOT_FEET){
164 $this->frostWalkerLevel =
null;
167 onContentChange:
function() :
void{ $this->frostWalkerLevel =
null; }
170 $health = $this->getMaxHealth();
172 if(($healFTag = $nbt->
getTag(self::TAG_LEGACY_HEALTH)) instanceof FloatTag){
173 $health = $healFTag->getValue();
174 }elseif(($healthTag = $nbt->
getTag(self::TAG_HEALTH)) instanceof ShortTag){
175 $health = $healthTag->getValue();
176 }elseif($healthTag instanceof FloatTag){
177 $health = $healthTag->getValue();
180 $this->setHealth($health);
182 $this->setAirSupplyTicks($nbt->getShort(self::TAG_BREATH_TICKS, self::DEFAULT_BREATH_TICKS));
185 $activeEffectsTag = $nbt->
getListTag(self::TAG_ACTIVE_EFFECTS);
186 if($activeEffectsTag !==
null){
187 foreach($activeEffectsTag as $e){
188 $effect = EffectIdMap::getInstance()->fromId($e->getByte(self::TAG_EFFECT_ID));
189 if($effect ===
null){
193 $this->effectManager->add(
new EffectInstance(
195 $e->getInt(self::TAG_EFFECT_DURATION),
196 Binary::unsignByte($e->getByte(self::TAG_EFFECT_AMPLIFIER)),
197 $e->getByte(self::TAG_EFFECT_SHOW_PARTICLES, 1) !== 0,
198 $e->getByte(self::TAG_EFFECT_AMBIENT, 0) !== 0
204 protected function addAttributes() : void{
205 $this->attributeMap->add($this->healthAttr = AttributeFactory::getInstance()->mustGet(Attribute::HEALTH));
206 $this->attributeMap->add(AttributeFactory::getInstance()->mustGet(Attribute::FOLLOW_RANGE));
207 $this->attributeMap->add($this->knockbackResistanceAttr = AttributeFactory::getInstance()->mustGet(Attribute::KNOCKBACK_RESISTANCE));
208 $this->attributeMap->add($this->moveSpeedAttr = AttributeFactory::getInstance()->mustGet(Attribute::MOVEMENT_SPEED));
209 $this->attributeMap->add(AttributeFactory::getInstance()->mustGet(Attribute::ATTACK_DAMAGE));
210 $this->attributeMap->add($this->absorptionAttr = AttributeFactory::getInstance()->mustGet(Attribute::ABSORPTION));
217 return $this->nameTag !==
"" ? $this->nameTag : $this->getName();
221 $wasAlive = $this->isAlive();
222 parent::setHealth($amount);
223 $this->healthAttr->setValue(ceil($this->getHealth()),
true);
224 if($this->isAlive() && !$wasAlive){
229 public function getMaxHealth() : int{
230 return (int) $this->healthAttr->getMaxValue();
233 public function setMaxHealth(
int $amount) : void{
234 $this->healthAttr->setMaxValue($amount)->setDefaultValue($amount);
237 public function getAbsorption() : float{
238 return $this->absorptionAttr->getValue();
241 public function setAbsorption(
float $absorption) : void{
242 $this->absorptionAttr->setValue($absorption);
245 public function getSneakOffset() : float{
249 public function isSneaking() : bool{
250 return $this->sneaking;
253 public function setSneaking(
bool $value =
true) : void{
254 $this->sneaking = $value;
255 $this->networkPropertiesDirty =
true;
256 $this->recalculateSize();
259 public function isSprinting() : bool{
260 return $this->sprinting;
263 public function setSprinting(
bool $value =
true) : void{
264 if($value !== $this->isSprinting()){
265 $this->sprinting = $value;
266 $this->networkPropertiesDirty =
true;
267 $moveSpeed = $this->getMovementSpeed();
268 $this->setMovementSpeed($value ? ($moveSpeed * 1.3) : ($moveSpeed / 1.3));
269 $this->moveSpeedAttr->markSynchronized(
false);
273 public function isGliding() : bool{
274 return $this->gliding;
277 public function setGliding(
bool $value =
true) : void{
278 $this->gliding = $value;
279 $this->networkPropertiesDirty =
true;
280 $this->recalculateSize();
283 public function isSwimming() : bool{
284 return $this->swimming;
287 public function setSwimming(
bool $value =
true) : void{
288 $this->swimming = $value;
289 $this->networkPropertiesDirty =
true;
290 $this->recalculateSize();
293 private function recalculateSize() : void{
294 $size = $this->getInitialSizeInfo();
295 if($this->isSwimming() || $this->isGliding()){
296 $width = $size->getWidth();
297 $this->setSize((
new EntitySizeInfo($width, $width, $width * 0.9))->scale($this->getScale()));
298 }elseif($this->isSneaking()){
299 $this->setSize((
new EntitySizeInfo($size->getHeight() - $this->getSneakOffset(), $size->getWidth(), $size->getEyeHeight() - $this->getSneakOffset()))->scale($this->getScale()));
301 $this->setSize($size->scale($this->getScale()));
305 public function getMovementSpeed() : float{
306 return $this->moveSpeedAttr->getValue();
309 public function setMovementSpeed(
float $v,
bool $fit =
false) : void{
310 $this->moveSpeedAttr->setValue($v, $fit);
313 public function saveNBT() : CompoundTag{
314 $nbt = parent::saveNBT();
315 $nbt->
setFloat(self::TAG_HEALTH, $this->getHealth());
317 $nbt->
setShort(self::TAG_BREATH_TICKS, $this->getAirSupplyTicks());
319 if(count($this->effectManager->all()) > 0){
321 foreach($this->effectManager->all() as $effect){
322 $effects[] = CompoundTag::create()
323 ->setByte(self::TAG_EFFECT_ID, EffectIdMap::getInstance()->toId($effect->getType()))
324 ->setByte(self::TAG_EFFECT_AMPLIFIER, Binary::signByte($effect->getAmplifier()))
325 ->setInt(self::TAG_EFFECT_DURATION, $effect->getDuration())
326 ->setByte(self::TAG_EFFECT_AMBIENT, $effect->isAmbient() ? 1 : 0)
327 ->setByte(self::TAG_EFFECT_SHOW_PARTICLES, $effect->isVisible() ? 1 : 0);
330 $nbt->
setTag(self::TAG_ACTIVE_EFFECTS,
new ListTag($effects));
337 return $this->effectManager;
345 $this->applyConsumptionResults($consumable);
354 foreach($consumable->getAdditionalEffects() as $effect){
355 $this->effectManager->add($effect);
361 $consumable->onConsume($this);
368 return $this->jumpVelocity + ((($jumpBoost = $this->effectManager->get(
VanillaEffects::JUMP_BOOST())) !== null ? $jumpBoost->getEffectLevel() : 0) / 10);
376 $this->motion = $this->motion->withComponents(
null, $this->getJumpVelocity(),
null);
380 protected function calculateFallDamage(
float $fallDistance) : float{
381 return ceil($fallDistance - 3 - (($jumpBoost = $this->effectManager->get(VanillaEffects::JUMP_BOOST())) !== null ? $jumpBoost->getEffectLevel() : 0));
385 $fallBlockPos = $this->location->floor();
386 $fallBlock = $this->getWorld()->getBlock($fallBlockPos);
387 if(count($fallBlock->getCollisionBoxes()) === 0){
388 $fallBlockPos = $fallBlockPos->down();
389 $fallBlock = $this->getWorld()->getBlock($fallBlockPos);
391 $newVerticalVelocity = $fallBlock->onEntityLand($this);
393 $damage = $this->calculateFallDamage($this->fallDistance);
398 $this->broadcastSound($damage > 4 ?
402 }elseif($fallBlock->getTypeId() !== BlockTypeIds::AIR){
403 $this->broadcastSound(
new EntityLandSound($this, $fallBlock));
405 return $newVerticalVelocity;
415 foreach($this->armorInventory->getContents() as $item){
416 $total += $item->getDefensePoints();
427 foreach($this->armorInventory->getContents() as $item){
428 $result = max($result, $item->getEnchantmentLevel($enchantment));
434 public function getArmorInventory() : ArmorInventory{
435 return $this->armorInventory;
438 public function setOnFire(
int $seconds) : void{
439 parent::setOnFire($seconds - (int) min($seconds, $seconds * $this->getHighestArmorEnchantmentLevel(VanillaEnchantments::FIRE_PROTECTION()) * 0.15));
447 if($this->lastDamageCause !== null && $this->attackTime > 0){
448 if($this->lastDamageCause->getBaseDamage() >= $source->
getBaseDamage()){
451 $source->setModifier(-$this->lastDamageCause->getBaseDamage(), EntityDamageEvent::MODIFIER_PREVIOUS_DAMAGE_COOLDOWN);
453 if($source->canBeReducedByArmor()){
455 $source->setModifier(-$source->getFinalDamage() * $this->getArmorPoints() * 0.04, EntityDamageEvent::MODIFIER_ARMOR);
458 $cause = $source->getCause();
459 if(($resistance = $this->effectManager->get(VanillaEffects::RESISTANCE())) !==
null && $cause !== EntityDamageEvent::CAUSE_VOID && $cause !== EntityDamageEvent::CAUSE_SUICIDE){
460 $source->setModifier(-$source->getFinalDamage() * min(1, 0.2 * $resistance->getEffectLevel()), EntityDamageEvent::MODIFIER_RESISTANCE);
464 foreach($this->armorInventory->getContents() as $item){
465 if($item instanceof Armor){
466 $totalEpf += $item->getEnchantmentProtectionFactor($source);
469 $source->setModifier(-$source->getFinalDamage() * min(ceil(min($totalEpf, 25) * (mt_rand(50, 100) / 100)), 20) * 0.04, EntityDamageEvent::MODIFIER_ARMOR_ENCHANTMENTS);
471 $source->setModifier(-min($this->getAbsorption(), $source->getFinalDamage()), EntityDamageEvent::MODIFIER_ABSORPTION);
473 if($cause === EntityDamageEvent::CAUSE_FALLING_BLOCK && $this->armorInventory->getHelmet() instanceof Armor){
474 $source->setModifier(-($source->getFinalDamage() / 4), EntityDamageEvent::MODIFIER_ARMOR_HELMET);
484 $this->setAbsorption(max(0, $this->getAbsorption() + $source->getModifier(
EntityDamageEvent::MODIFIER_ABSORPTION)));
486 $this->damageArmor($source->getBaseDamage());
491 foreach($this->armorInventory->getContents() as $k => $item){
492 if($item instanceof Armor && ($thornsLevel = $item->getEnchantmentLevel(VanillaEnchantments::THORNS())) > 0){
493 if(mt_rand(0, 99) < $thornsLevel * 15){
494 $this->damageItem($item, 3);
495 $damage += ($thornsLevel > 10 ? $thornsLevel - 10 : 1 + mt_rand(0, 3));
497 $this->damageItem($item, 1);
500 $this->armorInventory->setItem($k, $item);
505 $attacker->attack(new EntityDamageByEntityEvent($this, $attacker, EntityDamageEvent::CAUSE_MAGIC, $damage));
508 if($source->getModifier(EntityDamageEvent::MODIFIER_ARMOR_HELMET) < 0){
509 $helmet = $this->armorInventory->getHelmet();
510 if($helmet instanceof Armor){
511 $finalDamage = $source->getFinalDamage();
512 $this->damageItem($helmet, (int) round($finalDamage * 4 + Utils::getRandomFloat() * $finalDamage * 2));
513 $this->armorInventory->setHelmet($helmet);
524 $durabilityRemoved = (int) max(floor($damage / 4), 1);
526 $armor = $this->armorInventory->getContents();
527 foreach($armor as $slotId => $item){
528 if($item instanceof
Armor){
529 $oldItem = clone $item;
530 $this->damageItem($item, $durabilityRemoved);
531 if(!$item->equalsExact($oldItem)){
532 $this->armorInventory->setItem($slotId, $item);
538 private function damageItem(Durable $item,
int $durabilityRemoved) : void{
539 $item->applyDamage($durabilityRemoved);
540 if($item->isBroken()){
541 $this->broadcastSound(new ItemBreakSound());
545 public function attack(EntityDamageEvent $source) : void{
546 if($this->noDamageTicks > 0 && $source->getCause() !== EntityDamageEvent::CAUSE_SUICIDE){
550 if($this->effectManager->has(VanillaEffects::FIRE_RESISTANCE()) && (
551 $source->getCause() === EntityDamageEvent::CAUSE_FIRE
552 || $source->getCause() === EntityDamageEvent::CAUSE_FIRE_TICK
553 || $source->getCause() === EntityDamageEvent::CAUSE_LAVA
559 if($source->getCause() !== EntityDamageEvent::CAUSE_SUICIDE){
560 $this->applyDamageModifiers($source);
563 if($source instanceof EntityDamageByEntityEvent && (
564 $source->getCause() === EntityDamageEvent::CAUSE_BLOCK_EXPLOSION ||
565 $source->getCause() === EntityDamageEvent::CAUSE_ENTITY_EXPLOSION)
569 $base = $source->getKnockBack();
570 $source->setKnockBack($base - min($base, $base * $this->getHighestArmorEnchantmentLevel(VanillaEnchantments::BLAST_PROTECTION()) * 0.15));
573 parent::attack($source);
575 if($source->isCancelled()){
579 if($this->attackTime <= 0){
582 $this->attackTime = $source->getAttackCooldown();
584 if($source instanceof EntityDamageByChildEntityEvent){
585 $e = $source->getChild();
587 $motion = $e->getMotion();
588 $this->knockBack($motion->x, $motion->z, $source->getKnockBack(), $source->getVerticalKnockBackLimit());
590 }elseif($source instanceof EntityDamageByEntityEvent){
591 $e = $source->getDamager();
593 $deltaX = $this->location->x - $e->location->x;
594 $deltaZ = $this->location->z - $e->location->z;
595 $this->knockBack($deltaX, $deltaZ, $source->getKnockBack(), $source->getVerticalKnockBackLimit());
599 if($this->isAlive()){
600 $this->doHitAnimation();
604 if($this->isAlive()){
605 $this->applyPostDamageEffects($source);
609 protected function doHitAnimation() : void{
610 $this->broadcastAnimation(new HurtAnimation($this));
613 public function knockBack(
float $x,
float $z,
float $force = self::DEFAULT_KNOCKBACK_FORCE, ?
float $verticalLimit = self::DEFAULT_KNOCKBACK_VERTICAL_LIMIT) : void{
614 $f = sqrt($x * $x + $z * $z);
618 if(mt_rand() / mt_getrandmax() > $this->knockbackResistanceAttr->getValue()){
621 $motionX = $this->motion->x / 2;
622 $motionY = $this->motion->y / 2;
623 $motionZ = $this->motion->z / 2;
624 $motionX += $x * $f * $force;
626 $motionZ += $z * $f * $force;
628 $verticalLimit ??= $force;
629 if($motionY > $verticalLimit){
630 $motionY = $verticalLimit;
633 $this->setMotion(
new Vector3($motionX, $motionY, $motionZ));
638 $ev = new
EntityDeathEvent($this, $this->getDrops(), $this->getXpDropAmount());
640 foreach($ev->getDrops() as $item){
641 $this->getWorld()->dropItem($this->location, $item);
645 $this->getWorld()->dropExperience($this->location, $ev->getXpDropAmount());
647 $this->startDeathAnimation();
651 if($this->deadTicks < $this->maxDeadTicks){
652 $this->deadTicks += $tickDiff;
653 if($this->deadTicks >= $this->maxDeadTicks){
654 $this->endDeathAnimation();
658 return $this->deadTicks >= $this->maxDeadTicks;
661 protected function startDeathAnimation() : void{
662 $this->broadcastAnimation(new DeathAnimation($this));
665 protected function endDeathAnimation() : void{
666 $this->despawnFromAll();
669 protected function entityBaseTick(
int $tickDiff = 1) : bool{
670 Timings::$livingEntityBaseTick->startTiming();
672 $hasUpdate = parent::entityBaseTick($tickDiff);
674 if($this->isAlive()){
675 if($this->effectManager->tick($tickDiff)){
679 if($this->isInsideOfSolid()){
681 $ev =
new EntityDamageEvent($this, EntityDamageEvent::CAUSE_SUFFOCATION, 1);
685 if($this->doAirSupplyTick($tickDiff)){
689 foreach($this->armorInventory->getContents() as $index => $item){
690 $oldItem = clone $item;
691 if($item->onTickWorn($this)){
693 if(!$item->equalsExact($oldItem)){
694 $this->armorInventory->setItem($index, $item);
700 if($this->attackTime > 0){
701 $this->attackTime -= $tickDiff;
704 Timings::$livingEntityBaseTick->stopTiming();
709 protected function move(
float $dx,
float $dy,
float $dz) : void{
710 $oldX = $this->location->x;
711 $oldZ = $this->location->z;
713 parent::move($dx, $dy, $dz);
715 $frostWalkerLevel = $this->getFrostWalkerLevel();
716 if($frostWalkerLevel > 0 && (abs($this->location->x - $oldX) > self::MOTION_THRESHOLD || abs($this->location->z - $oldZ) > self::MOTION_THRESHOLD)){
717 $this->applyFrostWalker($frostWalkerLevel);
721 protected function applyFrostWalker(
int $level) : void{
722 $radius = $level + 2;
723 $world = $this->getWorld();
725 $baseX = $this->location->getFloorX();
726 $y = $this->location->getFloorY() - 1;
727 $baseZ = $this->location->getFloorZ();
729 $liquid = VanillaBlocks::WATER();
730 $targetBlock = VanillaBlocks::FROSTED_ICE();
731 if(EntityFrostWalkerEvent::hasHandlers()){
732 $ev =
new EntityFrostWalkerEvent($this, $radius, $liquid, $targetBlock);
734 if($ev->isCancelled()){
737 $radius = $ev->getRadius();
738 $liquid = $ev->getLiquid();
739 $targetBlock = $ev->getTargetBlock();
742 for($x = $baseX - $radius; $x <= $baseX + $radius; $x++){
743 for($z = $baseZ - $radius; $z <= $baseZ + $radius; $z++){
744 $block = $world->getBlockAt($x, $y, $z);
746 !$block->isSameState($liquid) ||
747 $world->getBlockAt($x, $y + 1, $z)->getTypeId() !== BlockTypeIds::AIR ||
748 count($world->getNearbyEntities(AxisAlignedBB::one()->offsetCopy($x, $y, $z))) !== 0
752 $world->setBlockAt($x, $y, $z, $targetBlock);
757 public function getFrostWalkerLevel() : int{
758 return $this->frostWalkerLevel ??= $this->armorInventory->getBoots()->
getEnchantmentLevel(VanillaEnchantments::FROST_WALKER());
765 $ticks = $this->getAirSupplyTicks();
767 if(!$this->canBreathe()){
768 $this->setBreathing(
false);
770 if(($respirationLevel = $this->armorInventory->getHelmet()->getEnchantmentLevel(VanillaEnchantments::RESPIRATION())) <= 0 ||
771 Utils::getRandomFloat() <= (1 / ($respirationLevel + 1))
776 $this->onAirExpired();
779 }elseif(!$this->isBreathing()){
780 if($ticks < ($max = $this->getMaxAirSupplyTicks())){
781 $ticks += $tickDiff * 5;
785 $this->setBreathing(
true);
789 if($ticks !== $oldTicks){
790 $this->setAirSupplyTicks($ticks);
793 return $ticks !== $oldTicks;
800 return $this->effectManager->has(
VanillaEffects::WATER_BREATHING()) || $this->effectManager->has(
VanillaEffects::CONDUIT_POWER()) || !$this->isUnderwater();
807 return $this->breathing;
815 $this->breathing = $value;
816 $this->networkPropertiesDirty =
true;
824 return $this->breathTicks;
831 $this->breathTicks = $ticks;
832 $this->networkPropertiesDirty =
true;
839 return $this->maxBreathTicks;
846 $this->maxBreathTicks = $ticks;
847 $this->networkPropertiesDirty =
true;
879 public function getLineOfSight(
int $maxDistance,
int $maxLength = 0, array $transparent = []) : array{
880 if($maxDistance > 120){
884 if(count($transparent) === 0){
891 foreach(VoxelRayTrace::inDirection($this->location->add(0, $this->size->getEyeHeight(), 0), $this->getDirectionVector(), $maxDistance) as $vector3){
892 $block = $this->getWorld()->getBlockAt($vector3->x, $vector3->y, $vector3->z);
893 $blocks[$nextIndex++] = $block;
895 if($maxLength !== 0 && count($blocks) > $maxLength){
896 array_shift($blocks);
900 $id = $block->getTypeId();
902 if($transparent ===
null){
903 if($id !== BlockTypeIds::AIR){
907 if(!isset($transparent[$id])){
921 $line = $this->getLineOfSight($maxDistance, 1, $transparent);
922 if(count($line) > 0){
923 return array_shift($line);
934 $horizontal = sqrt(($target->x - $this->location->x) ** 2 + ($target->z - $this->location->z) ** 2);
935 $vertical = $target->y - ($this->location->y + $this->getEyeHeight());
936 $pitch = -atan2($vertical, $horizontal) / M_PI * 180;
938 $xDist = $target->x - $this->location->x;
939 $zDist = $target->z - $this->location->z;
941 $yaw = atan2($zDist, $xDist) / M_PI * 180 - 90;
946 $this->setRotation($yaw, $pitch);
950 parent::sendSpawnPacket($player);
952 $networkSession = $player->getNetworkSession();
953 $networkSession->getEntityEventBroadcaster()->onMobArmorChange([$networkSession], $this);
957 parent::syncNetworkData($properties);
959 $visibleEffects = [];
960 foreach ($this->effectManager->all() as $effect) {
961 if (!$effect->isVisible() || !$effect->getType()->hasBubbles()) {
964 $visibleEffects[EffectIdMap::getInstance()->toId($effect->getType())] = $effect->isAmbient();
968 ksort($visibleEffects, SORT_NUMERIC);
971 $packedEffectsCount = 0;
972 foreach ($visibleEffects as $effectId => $isAmbient) {
973 $effectsData = ($effectsData << 7) |
974 (($effectId & 0x3f) << 1) |
975 ($isAmbient ? 1 : 0);
977 if (++$packedEffectsCount >= 8) {
981 $properties->setLong(EntityMetadataProperties::VISIBLE_MOB_EFFECTS, $effectsData);
983 $properties->setShort(EntityMetadataProperties::AIR, $this->breathTicks);
984 $properties->setShort(EntityMetadataProperties::MAX_AIR, $this->maxBreathTicks);
986 $properties->setGenericFlag(EntityMetadataFlags::BREATHING, $this->breathing);
987 $properties->setGenericFlag(EntityMetadataFlags::SNEAKING, $this->sneaking);
988 $properties->setGenericFlag(EntityMetadataFlags::SPRINTING, $this->sprinting);
989 $properties->setGenericFlag(EntityMetadataFlags::GLIDING, $this->gliding);
990 $properties->setGenericFlag(EntityMetadataFlags::SWIMMING, $this->swimming);
994 $this->armorInventory->removeAllWindows();
995 $this->effectManager->getEffectAddHooks()->clear();
996 $this->effectManager->getEffectRemoveHooks()->clear();
1002 $this->effectManager
1004 parent::destroyCycles();