AvoidanceMode enum

Пакет: com.hypixel.hytale.server.npc.role

Файл: com/hypixel/hytale/server/npc/role/Role.java

implements: Supplier<String>

Поля (1)

МодификаторыТипИмя
private final String description

Методы (2)

МодификаторыВозвратСигнатура
abstract Any Any("Any avoidance allowed")
public String getpublic String get()

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.server.npc.role;

class="kw">import com.hypixel.hytale.common.util.ArrayUtil;
class="kw">import com.hypixel.hytale.component.CommandBuffer;
class="kw">import com.hypixel.hytale.component.ComponentAccessor;
class="kw">import com.hypixel.hytale.component.ComponentType;
class="kw">import com.hypixel.hytale.component.Holder;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.math.random.RandomExtra;
class="kw">import com.hypixel.hytale.math.shape.Box;
class="kw">import com.hypixel.hytale.math.util.TrigMathUtil;
class="kw">import com.hypixel.hytale.math.vector.Rotation3f;
class="kw">import com.hypixel.hytale.math.vector.Vector3dUtil;
class="kw">import com.hypixel.hytale.protocol.BlockMaterial;
class="kw">import com.hypixel.hytale.protocol.MovementStates;
class="kw">import com.hypixel.hytale.server.core.asset.type.model.config.Model;
class="kw">import com.hypixel.hytale.server.core.inventory.InventoryComponent;
class="kw">import com.hypixel.hytale.server.core.inventory.ItemStack;
class="kw">import com.hypixel.hytale.server.core.inventory.container.ItemContainer;
class="kw">import com.hypixel.hytale.server.core.modules.debug.DebugUtils;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.HealthRegenState;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
class="kw">import com.hypixel.hytale.server.core.modules.entity.damage.DeathComponent;
class="kw">import com.hypixel.hytale.server.core.modules.item.ItemModule;
class="kw">import com.hypixel.hytale.server.core.modules.splitvelocity.VelocityConfig;
class="kw">import com.hypixel.hytale.server.core.universe.world.World;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import com.hypixel.hytale.server.npc.NPCPlugin;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.BuilderSupport;
class="kw">import com.hypixel.hytale.server.npc.entities.NPCEntity;
class="kw">import com.hypixel.hytale.server.npc.instructions.BodyMotion;
class="kw">import com.hypixel.hytale.server.npc.instructions.ExecutionSupport;
class="kw">import com.hypixel.hytale.server.npc.instructions.IndexedInstructions;
class="kw">import com.hypixel.hytale.server.npc.instructions.Instruction;
class="kw">import com.hypixel.hytale.server.npc.movement.GroupSteeringAccumulator;
class="kw">import com.hypixel.hytale.server.npc.movement.Steering;
class="kw">import com.hypixel.hytale.server.npc.movement.constraints.RelaxedConstraint;
class="kw">import com.hypixel.hytale.server.npc.movement.controllers.MotionController;
class="kw">import com.hypixel.hytale.server.npc.movement.steeringforces.SteeringForceAvoidCollision;
class="kw">import com.hypixel.hytale.server.npc.role.builders.BuilderRole;
class="kw">import com.hypixel.hytale.server.npc.role.support.CombatSupport;
class="kw">import com.hypixel.hytale.server.npc.role.support.DebugSupport;
class="kw">import com.hypixel.hytale.server.npc.role.support.DisplayNameSupport;
class="kw">import com.hypixel.hytale.server.npc.role.support.EntitySupport;
class="kw">import com.hypixel.hytale.server.npc.role.support.FlagsComponent;
class="kw">import com.hypixel.hytale.server.npc.role.support.MarkedEntitySupport;
class="kw">import com.hypixel.hytale.server.npc.role.support.MotionContextSupport;
class="kw">import com.hypixel.hytale.server.npc.role.support.PlayerTaskSupport;
class="kw">import com.hypixel.hytale.server.npc.role.support.PositionCache;
class="kw">import com.hypixel.hytale.server.npc.role.support.StateSupport;
class="kw">import com.hypixel.hytale.server.npc.role.support.WorldSupport;
class="kw">import com.hypixel.hytale.server.npc.statetransition.StateTransitionController;
class="kw">import com.hypixel.hytale.server.npc.util.ComponentInfo;
class="kw">import com.hypixel.hytale.server.npc.util.IAnnotatedComponent;
class="kw">import com.hypixel.hytale.server.npc.util.IAnnotatedComponentCollection;
class="kw">import com.hypixel.hytale.server.npc.util.InventoryHelper;
class="kw">import com.hypixel.hytale.server.npc.util.NPCPhysicsMath;
class="kw">import com.hypixel.hytale.server.npc.util.VisHelper;
class="kw">import it.unimi.dsi.fastutil.objects.ObjectArrayList;
class="kw">import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet;
class="kw">import java.util.Arrays;
class="kw">import java.util.EnumSet;
class="kw">import java.util.HashMap;
class="kw">import java.util.List;
class="kw">import java.util.Map;
class="kw">import java.util.Set;
class="kw">import java.util.Map.Entry;
class="kw">import java.util.function.Supplier;
class="kw">import java.util.logging.Level;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">import org.joml.Vector3d;

class="kw">public class Role class="kw">implements IAnnotatedComponentCollection {
   class="kw">public class="kw">static class="kw">final boolean DEBUG_APPLIED_FORCES = false;
   class="kw">public class="kw">static class="kw">final double INTERACTION_PLAYER_DISTANCE = 10.0;
   class="kw">public class="kw">static class="kw">final double RANDOMIZE_OFFSET_MAX_DISTANCE = 0.001;
   class="kw">public class="kw">static class="kw">final double RANDOMIZE_OFFSET_SQUARED_MAX_DISTANCE = 1.0E-6;
   class="kw">private class="kw">static class="kw">final double MIN_SEPARATION_SUMMED_SQUARED = 0.010000000000000002;
   class="kw">protected class="kw">final int initialMaxHealth;
   class="kw">protected class="kw">final double collisionProbeDistance;
   class="kw">protected class="kw">final double collisionRadius;
   class="kw">protected class="kw">final double collisionForceFalloff;
   class="kw">protected class="kw">final float collisionViewAngle;
   class="kw">protected class="kw">final float collisionViewHalfAngleCosine;
   class="kw">protected class="kw">final Steering bodySteering = new Steering();
   class="kw">protected class="kw">final Steering headSteering = new Steering();
   class="kw">protected class="kw">final SteeringForceAvoidCollision steeringForceAvoidCollision = new SteeringForceAvoidCollision();
   class="kw">protected class="kw">final GroupSteeringAccumulator groupSteeringAccumulator = new GroupSteeringAccumulator();
   class="kw">protected class="kw">final Vector3d separationTempDistanceVector = new Vector3d();
   class="kw">protected class="kw">final Vector3d separationTempSteeringVector = new Vector3d();
   class="kw">protected class="kw">final Set<Ref<EntityStore>> ignoredEntitiesForAvoidance = new ReferenceOpenHashSet();
   class="kw">protected class="kw">final double entityAvoidanceStrength;
   class="kw">protected class="kw">final Role.AvoidanceMode avoidanceMode;
   class="kw">protected class="kw">final boolean isAvoidingEntities;
   class="kw">protected class="kw">final Role.SeparationMode separationMode;
   class="kw">protected class="kw">final boolean useOrientationHint;
   class="kw">protected class="kw">final boolean alwaysApplySeparation;
   class="kw">protected class="kw">final boolean normalizeDistances;
   class="kw">protected class="kw">final double separationDistance;
   class="kw">protected class="kw">final double separationWeight;
   class="kw">protected class="kw">final double separationDistanceTarget;
   class="kw">protected class="kw">final double separationNearRadiusTarget;
   class="kw">protected class="kw">final double separationFarRadiusTarget;
   class="kw">protected class="kw">final boolean applySeparation;
   class="kw">protected class="kw">final double separationSafeDistanceMultiplier;
   class="kw">protected class="kw">final double separationLegacySteeringStrength;
   class="kw">protected class="kw">final double separationPushSteeringStrength;
   class="kw">protected class="kw">final double separationPushDistanceWeightDefault;
   class="kw">protected class="kw">final double separationPushDistanceWeightTarget;
   class="kw">protected class="kw">final double separationPushDistanceWeightAttacker;
   class="kw">protected class="kw">final double separationPushSpeedScale;
   class="kw">protected class="kw">final Vector3d lastSeparationSteering = new Vector3d();
   class="kw">protected int separationSummedCount;
   class="kw">protected class="kw">final Vector3d separationSummedDistances = new Vector3d();
   @Nullable
   class="kw">protected class="kw">final float[] headPitchAngleRange;
   class="kw">protected class="kw">final boolean stayInEnvironment;
   class="kw">protected class="kw">final String allowedEnvironments;
   @Nullable
   class="kw">protected class="kw">final String[] flockSpawnTypes;
   class="kw">protected class="kw">final boolean flockSpawnTypesRandom;
   @Nonnull
   class="kw">protected class="kw">final String[] flockAllowedRoles;
   class="kw">protected class="kw">final boolean canLeadFlock;
   class="kw">protected class="kw">final double flockWeightAlignment;
   class="kw">protected class="kw">final double flockWeightSeparation;
   class="kw">protected class="kw">final double flockWeightCohesion;
   class="kw">protected class="kw">final double flockInfluenceRange;
   class="kw">protected class="kw">final boolean corpseStaysInFlock;
   class="kw">protected class="kw">final double inertia;
   class="kw">protected class="kw">final double knockbackScale;
   class="kw">protected class="kw">final boolean breathesInAir;
   class="kw">protected class="kw">final boolean breathesInWater;
   class="kw">protected class="kw">final boolean pickupDropOnDeath;
   @Nullable
   class="kw">protected class="kw">final String[] hotbarItems;
   @Nullable
   class="kw">protected class="kw">final String[] offHandItems;
   class="kw">protected class="kw">final double deathAnimationTime;
   class="kw">protected class="kw">final String deathParticles;
   class="kw">protected class="kw">final boolean dropDeathItemsInstantly;
   class="kw">protected class="kw">final float despawnAnimationTime;
   class="kw">protected class="kw">final String dropListId;
   @Nullable
   class="kw">protected class="kw">final String deathInteraction;
   class="kw">protected class="kw">final boolean invulnerable;
   class="kw">protected class="kw">final int inventorySlots;
   class="kw">protected class="kw">final String inventoryContentsDropList;
   class="kw">protected class="kw">final int hotbarSlots;
   class="kw">protected class="kw">final int offHandSlots;
   class="kw">protected class="kw">final byte defaultOffHandSlot;
   @Nullable
   class="kw">protected class="kw">final String balanceAsset;
   @Nullable
   class="kw">protected class="kw">final Map<String, String> interactionVars;
   class="kw">protected int roleIndex;
   class="kw">protected String roleName;
   class="kw">protected String appearance;
   @Nonnull
   class="kw">protected Map<String, MotionController> motionControllers = new HashMap<>();
   @Nullable
   class="kw">protected String initialMotionControllerName;
   class="kw">protected MotionController activeMotionController;
   class="kw">protected int[] flockSpawnTypeIndices;
   class="kw">protected boolean requiresLeashPosition;
   class="kw">protected boolean hasReachedTerminalAction;
   @Nullable
   class="kw">protected String[] armor;
   class="kw">protected Instruction rootInstruction;
   @Nullable
   class="kw">protected Instruction lastBodyMotionStep;
   @Nullable
   class="kw">protected Instruction lastHeadMotionStep;
   class="kw">protected IndexedInstructions indexedInstructions;
   @Nullable
   class="kw">protected Instruction interactionInstruction;
   @Nullable
   class="kw">protected Instruction deathInstruction;
   class="kw">protected boolean roleChangeRequested;
   class="kw">protected class="kw">final boolean isMemory;
   class="kw">protected class="kw">final String memoriesNameOverride;
   class="kw">protected class="kw">final boolean isMemoriesNameOverriden;
   class="kw">protected class="kw">final float spawnLockTime;
   class="kw">protected class="kw">final String nameTranslationKey;
   class="kw">protected boolean backingAway;
   class="kw">protected boolean deathItemsDropped;

   @Nonnull
   class="kw">public class="kw">static Role createAndAttach(@Nonnull Holder<EntityStore> var0, @Nonnull BuilderRole var1, @Nonnull BuilderSupport var2) {
      CombatSupport var3 = new CombatSupport(var1, var2);
      StateSupport var4 = new StateSupport(var1, var2);
      WorldSupport var5 = new WorldSupport(var1, var2);
      EntitySupport var6 = new EntitySupport();
      PositionCache var7 = new PositionCache(var2.getRoleStats());
      var7.setOpaqueBlockSet(var1.getOpaqueBlockSet());
      DebugSupport var8 = new DebugSupport(var1);
      FlagsComponent var9 = new FlagsComponent();
      DisplayNameSupport var10 = new DisplayNameSupport();
      var10.setDisplayNames(var1.getDisplayNames());
      MotionContextSupport var11 = new MotionContextSupport();
      PlayerTaskSupport var12 = new PlayerTaskSupport();
      HealthRegenState var13 = new HealthRegenState();
      var0.putComponent(CombatSupport.getComponentType(), var3);
      var0.putComponent(StateSupport.getComponentType(), var4);
      if (var0.getComponent(MarkedEntitySupport.getComponentType()) == null) {
         var0.putComponent(MarkedEntitySupport.getComponentType(), new MarkedEntitySupport());
      }

      var0.putComponent(WorldSupport.getComponentType(), var5);
      var0.putComponent(EntitySupport.getComponentType(), var6);
      var0.putComponent(PositionCache.getComponentType(), var7);
      var0.putComponent(DebugSupport.getComponentType(), var8);
      var0.putComponent(FlagsComponent.getComponentType(), var9);
      var0.putComponent(DisplayNameSupport.getComponentType(), var10);
      var0.putComponent(MotionContextSupport.getComponentType(), var11);
      var0.putComponent(PlayerTaskSupport.getComponentType(), var12);
      var0.putComponent(HealthRegenState.getComponentType(), var13);
      Role var14 = new Role(var1, var2);
      var14.postRoleBuilt(var0, var2);
      var14.preInitMotionControllers(var8, var1.getMotionControllerMap(var2), var1.getInitialMotionController(var2));
      class="kw">return var14;
   }

   class="kw">private Role(@Nonnull BuilderRole var1, @Nonnull BuilderSupport var2) {
      this.initialMaxHealth = var1.getMaxHealth(var2);
      this.nameTranslationKey = var1.getNameTranslationKey(var2);
      this.appearance = var1.getAppearance(var2);
      this.hotbarItems = var1.getHotbarItems(var2);
      this.offHandItems = var1.getOffHandItems(var2);
      this.defaultOffHandSlot = var1.getDefaultOffHandSlot(var2);
      this.inventoryContentsDropList = var1.getInventoryItemsDropList(var2);
      this.armor = var1.getArmor();
      this.inertia = var1.getInertia();

      for (MotionController var4 : this.motionControllers.values()) {
         var4.setInertia(this.inertia);
      }

      this.knockbackScale = var1.getKnockbackScale(var2);

      for (MotionController var7 : this.motionControllers.values()) {
         var7.setKnockbackScale(this.knockbackScale);
      }

      this.dropListId = var1.getDropListId(var2);
      this.isAvoidingEntities = var1.isAvoidingEntities();
      this.avoidanceMode = var1.getAvoidanceMode(var2);
      this.collisionProbeDistance = var1.getCollisionDistance();
      this.collisionForceFalloff = var1.getCollisionForceFalloff();
      this.collisionRadius = var1.getCollisionRadius();
      this.collisionViewAngle = var1.getCollisionViewAngle();
      this.collisionViewHalfAngleCosine = TrigMathUtil.cos(this.collisionViewAngle / 2.0F);
      this.separationMode = var1.getSeparationMode(var2);
      this.separationDistance = var1.getSeparationDistance(var2);
      this.separationWeight = var1.getSeparationWeight(var2);
      this.separationDistanceTarget = var1.getSeparationDistanceTarget(var2);
      this.separationNearRadiusTarget = var1.getSeparationNearRadiusTarget(var2);
      this.separationFarRadiusTarget = var1.getSeparationFarRadiusTarget(var2);
      this.applySeparation = var1.isApplySeparation(var2);
      this.separationSafeDistanceMultiplier = var1.getSeparationSafeDistanceMultiplier(var2);
      this.separationLegacySteeringStrength = var1.getSeparationLegacySteeringStrength(var2);
      this.separationPushSteeringStrength = var1.getSeparationPushSteeringStrength(var2);
      this.separationPushDistanceWeightDefault = var1.getSeparationPushDistanceWeightDefault(var2);
      this.separationPushDistanceWeightTarget = var1.getSeparationPushDistanceWeightTarget(var2);
      this.separationPushDistanceWeightAttacker = var1.getSeparationPushDistanceWeightAttacker(var2);
      this.separationPushSpeedScale = var1.getSeparationPushSpeedScale(var2);
      this.useOrientationHint = var1.getOverrideUseOrientationHint(var2).evaluate(this.separationMode != Role.SeparationMode.Legacy);
      this.alwaysApplySeparation = var1.getOverrideAlwaysSeparate(var2).evaluate(this.separationMode != Role.SeparationMode.Legacy);
      this.normalizeDistances = var1.getOverrideNormalizeDistances(var2).evaluate(this.separationMode != Role.SeparationMode.Legacy);
      if (var1.isOverridingHeadPitchAngle(var2)) {
         this.headPitchAngleRange = var1.getHeadPitchAngleRange(var2);
      } else {
         this.headPitchAngleRange = null;
      }

      this.stayInEnvironment = var1.isStayingInEnvironment();
      this.allowedEnvironments = var1.getAllowedEnvironments();
      this.entityAvoidanceStrength = var1.getEntityAvoidanceStrength();
      this.flockSpawnTypes = var1.getFlockSpawnTypes(var2);
      this.flockSpawnTypesRandom = var1.isFlockSpawnTypeRandom(var2);
      this.flockAllowedRoles = var1.getFlockAllowedRoles(var2);
      this.canLeadFlock = var1.isCanLeadFlock(var2);
      this.flockWeightAlignment = var1.getFlockWeightAlignment();
      this.flockWeightSeparation = var1.getFlockWeightSeparation();
      this.flockWeightCohesion = var1.getFlockWeightCohesion();
      this.flockInfluenceRange = var1.getFlockInfluenceRange();
      this.invulnerable = var1.isInvulnerable(var2);
      this.breathesInAir = var1.breathesInAir(var2.getExecutionContext(), null);
      this.breathesInWater = var1.breathesInWater(var2.getExecutionContext(), null);
      this.pickupDropOnDeath = var1.isPickupDropOnDeath();
      this.deathAnimationTime = var1.getDeathAnimationTime(var2);
      this.deathParticles = var1.getDeathParticles(var2);
      this.dropDeathItemsInstantly = var1.isDropDeathItemsInstantly(var2);
      this.deathInteraction = var1.getDeathInteraction(var2);
      this.despawnAnimationTime = var1.getDespawnAnimationTime();
      this.inventorySlots = var1.getInventorySlots();
      this.hotbarSlots = var1.getHotbarSlots();
      this.offHandSlots = var1.getOffHandSlots();
      this.corpseStaysInFlock = var1.isCorpseStaysInFlock();
      this.balanceAsset = var1.getBalanceAsset(var2);
      this.interactionVars = var1.getInteractionVars(var2);
      this.isMemory = var1.isMemory(var2.getExecutionContext());
      this.memoriesNameOverride = var1.getMemoriesNameOverride(var2.getExecutionContext());
      this.isMemoriesNameOverriden = this.memoriesNameOverride != null && !this.memoriesNameOverride.isEmpty();
      this.spawnLockTime = var1.getSpawnLockTime(var2);
      DisplayNameSupport.setRandomDisplayName(var2.getHolder(), var1.getDisplayNames(), false);
      List var6 = var1.getInstructionList(var2);
      if (var6 == null) {
         var6 = new ObjectArrayList();
      }

      Instruction[] var8 = var6.toArray(Instruction[]::new);
      this.rootInstruction = Instruction.createRootInstruction(var8, var2);
      this.interactionInstruction = var1.getInteractionInstruction(var2);
      this.deathInstruction = var1.getDeathInstruction(var2);
      var1.registerStateEvaluator(var2);
      if (this.interactionInstruction != null) {
         var2.trackInteractions();
      }
   }

   class="kw">public int getInitialMaxHealth() {
      class="kw">return this.initialMaxHealth;
   }

   class="kw">public boolean isAvoidingEntities() {
      class="kw">return this.isAvoidingEntities;
   }

   class="kw">public double getCollisionProbeDistance() {
      class="kw">return this.collisionProbeDistance;
   }

   class="kw">public boolean isApplySeparation() {
      class="kw">return this.applySeparation;
   }

   class="kw">public double getSeparationDistance() {
      class="kw">return this.separationDistance;
   }

   class="kw">public Instruction getRootInstruction() {
      class="kw">return this.rootInstruction;
   }

   @Nullable
   class="kw">public Instruction getInteractionInstruction() {
      class="kw">return this.interactionInstruction;
   }

   @Nullable
   class="kw">public Instruction getDeathInstruction() {
      class="kw">return this.deathInstruction;
   }

   @Nonnull
   class="kw">public Steering getBodySteering() {
      class="kw">return this.bodySteering;
   }

   @Nonnull
   class="kw">public Steering getHeadSteering() {
      class="kw">return this.headSteering;
   }

   @Nonnull
   class="kw">public Set<Ref<EntityStore>> getIgnoredEntitiesForAvoidance() {
      class="kw">return this.ignoredEntitiesForAvoidance;
   }

   class="kw">public String getDropListId() {
      class="kw">return this.dropListId;
   }

   @Nullable
   class="kw">public String getBalanceAsset() {
      class="kw">return this.balanceAsset;
   }

   @Nullable
   class="kw">public Map<String, String> getInteractionVars() {
      class="kw">return this.interactionVars;
   }

   class="kw">public boolean isMemory() {
      class="kw">return this.isMemory;
   }

   class="kw">public String getMemoriesNameOverride() {
      class="kw">return this.memoriesNameOverride;
   }

   class="kw">public String getNameTranslationKey() {
      class="kw">return this.nameTranslationKey;
   }

   class="kw">public boolean isMemoriesNameOverriden() {
      class="kw">return this.isMemoriesNameOverriden;
   }

   class="kw">public float getSpawnLockTime() {
      class="kw">return this.spawnLockTime;
   }

   class="kw">public void postRoleBuilt(@Nonnull Holder<EntityStore> var1, @Nonnull BuilderSupport var2) {
      this.requiresLeashPosition = var2.requiresLeashPosition();
      var1.getComponent(FlagsComponent.getComponentType()).setFlags(var2.allocateFlags());
      this.indexedInstructions = new IndexedInstructions(var2.getInstructionSlotMappings());
      var1.getComponent(StateSupport.getComponentType()).postRoleBuilt(var2);
      var1.getComponent(WorldSupport.getComponentType()).postRoleBuilt(var2);
      var1.getComponent(EntitySupport.getComponentType()).postRoleBuilt(var2);
      var1.getComponent(MarkedEntitySupport.getComponentType()).postRoleBuilder(var2);
      this.rootInstruction.setContext(this, 0);
   }

   @Nonnull
   class="kw">public ExecutionSupport acquireExecutionSupport(@Nonnull Ref<EntityStore> var1, @Nonnull ComponentAccessor<EntityStore> var2) {
      ExecutionSupport var3 = ExecutionSupport.acquire();
      var3.populateFromEntity(var1, var2);
      var3.setRoleIndex(this.roleIndex);
      var3.setName(this.roleName);
      var3.setIndexedInstructions(this.indexedInstructions);
      class="kw">return var3;
   }

   class="kw">public void loaded(@Nonnull Ref<EntityStore> var1, @Nonnull ComponentAccessor<EntityStore> var2) {
      ExecutionSupport var3 = this.acquireExecutionSupport(var1, var2);

      try {
         this.rootInstruction.loaded(var3);
         if (this.interactionInstruction != null) {
            this.interactionInstruction.loaded(var3);
         }

         if (this.deathInstruction != null) {
            this.deathInstruction.loaded(var3);
         }

         StateTransitionController var4 = var3.getStateSupport().getStateTransitionController();
         if (var4 != null) {
            var4.loaded(var3);
         }
      } class="kw">finally {
         var3.clearForReuse();
      }
   }

   class="kw">public void spawned(@Nonnull Holder<EntityStore> var1, @Nonnull NPCEntity var2, @Nonnull Store<EntityStore> var3) {
      MotionController var4 = this.activeMotionController;
      if (var4 != null) {
         var4.spawned();
      }

      var1.getComponent(DisplayNameSupport.getComponentType()).pickRandomDisplayName(var1, true);
      ExecutionSupport var5 = ExecutionSupport.acquire();
      var5.populateFromHolder(var1);
      var5.setRoleIndex(this.roleIndex);
      var5.setName(this.roleName);
      var5.setIndexedInstructions(this.indexedInstructions);

      try {
         this.rootInstruction.spawned(var5);
         if (this.interactionInstruction != null) {
            this.interactionInstruction.spawned(var5);
         }

         if (this.deathInstruction != null) {
            this.deathInstruction.spawned(var5);
         }

         StateTransitionController var6 = var5.getStateSupport().getStateTransitionController();
         if (var6 != null) {
            var6.spawned(var5);
         }
      } class="kw">finally {
         var5.clearForReuse();
      }

      this.initialiseInventories(var2, var1, var3);
   }

   class="kw">public void unloaded(@Nonnull Ref<EntityStore> var1, @Nonnull ComponentAccessor<EntityStore> var2) {
      ExecutionSupport var3 = this.acquireExecutionSupport(var1, var2);

      try {
         var3.getEntitySupport().unloaded();
         var3.getWorldSupport().unloaded(var1);
         var3.getMarkedEntitySupport().unloaded();
         this.rootInstruction.unloaded(var3);
         if (this.interactionInstruction != null) {
            this.interactionInstruction.unloaded(var3);
         }

         if (this.deathInstruction != null) {
            this.deathInstruction.unloaded(var3);
         }

         StateTransitionController var4 = var3.getStateSupport().getStateTransitionController();
         if (var4 != null) {
            var4.unloaded(var3);
         }
      } class="kw">finally {
         var3.clearForReuse();
      }
   }

   class="kw">public void removed(@Nonnull Ref<EntityStore> var1, @Nonnull ComponentAccessor<EntityStore> var2) {
      ExecutionSupport var3 = this.acquireExecutionSupport(var1, var2);

      try {
         var3.getWorldSupport().resetAllBlockSensors(var1);
         this.rootInstruction.removed(var3);
         if (this.interactionInstruction != null) {
            this.interactionInstruction.removed(var3);
         }

         if (this.deathInstruction != null) {
            this.deathInstruction.removed(var3);
         }

         StateTransitionController var4 = var3.getStateSupport().getStateTransitionController();
         if (var4 != null) {
            var4.removed(var3);
         }
      } class="kw">finally {
         var3.clearForReuse();
      }
   }

   class="kw">public void teleported(@Nonnull Ref<EntityStore> var1, @Nonnull ComponentAccessor<EntityStore> var2, @Nonnull World var3, @Nonnull World var4) {
      ExecutionSupport var5 = this.acquireExecutionSupport(var1, var2);

      try {
         this.rootInstruction.teleported(var5, var3, var4);
         if (this.interactionInstruction != null) {
            this.interactionInstruction.teleported(var5, var3, var4);
         }

         if (this.deathInstruction != null) {
            this.deathInstruction.teleported(var5, var3, var4);
         }

         StateTransitionController var6 = var5.getStateSupport().getStateTransitionController();
         if (var6 != null) {
            var6.teleported(var5, var3, var4);
         }
      } class="kw">finally {
         var5.clearForReuse();
      }
   }

   class="kw">public String getAppearanceName() {
      class="kw">return this.appearance;
   }

   class="kw">public MotionController getActiveMotionController() {
      class="kw">return this.activeMotionController;
   }

   class="kw">public boolean isRoleChangeRequested() {
      class="kw">return this.roleChangeRequested;
   }

   class="kw">public void setRoleChangeRequested() {
      this.roleChangeRequested = true;
   }

   class="kw">public boolean setActiveMotionController(
      @Nonnull Ref<EntityStore> var1, @Nonnull NPCEntity var2, @Nonnull String var3, @Nonnull ComponentAccessor<EntityStore> var4
   ) {
      MotionController var5 = this.motionControllers.get(var3);
      if (var5 == null) {
         NPCPlugin.get()
            .getLogger()
            .at(Level.SEVERE)
            .log("Failed to set MotionController for NPC of type '%s': MotionController '%s' not found! ", this.roleName, var3);
         class="kw">return false;
      } else {
         this.setActiveMotionController(var1, var2, var5, var4);
         class="kw">return true;
      }
   }

   class="kw">public void setActiveMotionController(
      @Nonnull Ref<EntityStore> var1, @Nonnull NPCEntity var2, @Nonnull MotionController var3, @Nonnull ComponentAccessor<EntityStore> var4
   ) {
      if (this.activeMotionController != var3) {
         if (this.activeMotionController != null) {
            this.activeMotionController.deactivate();
         }

         this.activeMotionController = var3;
         MotionContextSupport var5 = var4.getComponent(var1, MotionContextSupport.getComponentType());
         assert var5 != null;
         var5.setActiveMotionController(var3);
         this.activeMotionController.activate();
         this.motionControllerChanged(var1, var2, this.activeMotionController, var4);
      }
   }

   class="kw">public boolean hasMotionController(@Nonnull String var1) {
      class="kw">return this.motionControllers.containsKey(var1);
   }

   class="kw">protected void motionControllerChanged(
      @Nonnull Ref<EntityStore> var1, @Nonnull NPCEntity var2, @Nullable MotionController var3, @Nonnull ComponentAccessor<EntityStore> var4
   ) {
      var2.setActiveMotionControllerName(var3 != null ? var3.getType() : null);
      this.rootInstruction.motionControllerChanged(var1, var2, var3, var4);
      if (this.deathInstruction != null) {
         this.deathInstruction.motionControllerChanged(var1, var2, var3, var4);
      }

      if (this.interactionInstruction != null) {
         this.interactionInstruction.motionControllerChanged(var1, var2, var3, var4);
      }

      StateTransitionController var5 = StateSupport.get(var1, var4).getStateTransitionController();
      if (var5 != null) {
         var5.motionControllerChanged(var1, var2, var3, var4);
      }
   }

   class="kw">public void preInitMotionControllers(@Nonnull DebugSupport var1, @Nonnull Map<String, MotionController> var2, @Nullable String var3) {
      this.motionControllers = var2;
      this.initialMotionControllerName = var3;

      for (Entry var5 : this.motionControllers.entrySet()) {
         var1.registerDebugFlagsListener(var5.getValue());
      }

      this.updateMotionControllers(null, null, null, null);
   }

   class="kw">public void activateInitialMotionController(@Nonnull Ref<EntityStore> var1, @Nonnull ComponentAccessor<EntityStore> var2, @Nonnull NPCEntity var3) {
      if (this.activeMotionController == null) {
         if (!this.motionControllers.isEmpty()) {
            if (this.initialMotionControllerName == null
               || !this.hasMotionController(this.initialMotionControllerName)
               || !this.setActiveMotionController(var1, var3, this.initialMotionControllerName, var2)) {
               this.setActiveMotionController(var1, var3, RandomExtra.randomElement(new ObjectArrayList(this.motionControllers.values())), var2);
            }
         }
      }
   }

   class="kw">public void updateMotionControllers(@Nullable Ref<EntityStore> var1, @Nullable Model var2, @Nullable Box var3, @Nullable ComponentAccessor<EntityStore> var4) {
      for (MotionController var6 : this.motionControllers.values()) {
         var6.setRole(this);
         var6.setInertia(this.inertia);
         var6.setKnockbackScale(this.knockbackScale);
         var6.setHeadPitchAngleRange(this.headPitchAngleRange);
         if (var3 != null && var2 != null) {
            var6.updateModelParameters(var1, var2, var3, var4);
            var6.updatePhysicsValues(var2.getPhysicsValues());
         }
      }
   }

   class="kw">public void updateMovementState(
      @Nonnull Ref<EntityStore> var1, @Nonnull MovementStates var2, @Nonnull Vector3d var3, @Nonnull ComponentAccessor<EntityStore> var4
   ) {
      if (this.activeMotionController != null) {
         this.activeMotionController.updateMovementState(var1, var2, this.bodySteering, var3, var4);
      }
   }

   class="kw">public void tick(@Nonnull Ref<EntityStore> var1, float var2, @Nonnull Store<EntityStore> var3) {
      ExecutionSupport var4 = this.acquireExecutionSupport(var1, var3);

      try {
         var4.getEntitySupport().tickDeferredActions(var1, var4, var2, var3);
         this.computeActionsAndSteering(var1, var4, var2, this.bodySteering, this.headSteering, var3);
      } class="kw">finally {
         var4.clearForReuse();
      }
   }

   class="kw">protected void computeActionsAndSteering(
      @Nonnull Ref<EntityStore> var1,
      @Nonnull ExecutionSupport var2,
      double var3,
      @Nonnull Steering var5,
      @Nonnull Steering var6,
      @Nonnull Store<EntityStore> var7
   ) {
      DebugSupport var8 = var2.getDebugSupport();
      if (var8.isVisSensorRanges()) {
         var8.beginSensorVisualization();
      }

      boolean var9 = var7.getArchetype(var1).contains(DeathComponent.getComponentType());
      if (var9) {
         if (this.deathInstruction != null && this.deathInstruction.matches(var1, var2, var3, var7)) {
            this.deathInstruction.execute(var1, var2, var3, var7);
         }
      } else {
         StateSupport var10 = var2.getStateSupport();
         if (this.interactionInstruction != null) {
            var2.getPositionCache().forEachPlayer((var1x, var3x, var4, var5x, var6x) -> {
               var4.getStateSupport().setInteractionIterationTarget(var3x);
               assert this.interactionInstruction != null;
               if (this.interactionInstruction.matches(var5x, var4, var1x, var6x)) {
                  this.interactionInstruction.execute(var5x, var4, var1x, var6x);
               }
            }, var2, var1, var7, var3, var7);
            var10.setInteractionIterationTarget(null);
            var2.getPlayerTaskSupport().clearTargetPlayerActiveTasks();
         }

         this.activeMotionController.beforeInstructionSensorsAndActions(var3);
         MotionContextSupport var11 = var2.getMotionContextSupport();
         if (!var10.runTransitionActions(var1, var2, var3, var7)) {
            var11.clearNextBodyMotionStep();
            var11.clearNextHeadMotionStep();
            this.rootInstruction.execute(var1, var2, var3, var7);
         } else {
            if (var10.isClearHeadMotion()) {
               var11.clearNextHeadMotionStep();
            }

            if (var10.isClearBodyMotion()) {
               var11.clearNextBodyMotionStep();
            }
         }

         NPCEntity var12 = var7.getComponent(var1, NPCEntity.getComponentType());
         assert var12 != null;
         if (!var12.isPlayingDespawnAnim()) {
            this.activeMotionController.beforeInstructionMotion(var3);
            Instruction var13 = var11.getNextBodyMotionStep();
            if (var13 != this.lastBodyMotionStep) {
               if (this.lastBodyMotionStep != null) {
                  this.lastBodyMotionStep.getBodyMotion().deactivate(var1, var2, var7);
                  this.lastBodyMotionStep.onEndMotion();
               }

               if (var13 != null) {
                  var13.getBodyMotion().activate(var1, var2, var7);
               }
            }

            this.lastBodyMotionStep = var13;
            Instruction var14 = var11.getNextHeadMotionStep();
            if (var14 != this.lastHeadMotionStep) {
               if (this.lastHeadMotionStep != null) {
                  this.lastHeadMotionStep.getHeadMotion().deactivate(var1, var2, var7);
                  this.lastHeadMotionStep.onEndMotion();
               }

               if (var14 != null) {
                  var14.getHeadMotion().activate(var1, var2, var7);
               }
            }

            this.lastHeadMotionStep = var14;
            if (var13 != null) {
               var13.getBodyMotion().computeSteering(var1, var2, var13.getSensor().getSensorInfo(), var3, var5, var7);
            }

            if (var14 != null) {
               var14.getHeadMotion().computeSteering(var1, var2, var14.getSensor().getSensorInfo(), var3, var6, var7);
            }
         }
      }
   }

   class="kw">public void blendSeparation(
      @Nonnull Ref<EntityStore> var1,
      @Nonnull Vector3d var2,
      @Nonnull Rotation3f var3,
      @Nonnull Steering var4,
      @Nonnull ComponentType<EntityStore, TransformComponent> var5,
      @Nonnull CommandBuffer<EntityStore> var6
   ) {
      this.lastSeparationSteering.zero();
      Ref var7 = MarkedEntitySupport.get(var1, var6).getTargetReferenceToIgnoreForAvoidance();
      Ref var8 = var7 != null && var7.isValid() ? var7 : null;
      this.separationSummedDistances.zero();
      this.separationSummedCount = 0;
      class="kw">switch (this.separationMode) {
         case Legacy:
            this.computeSummedDistanceLegacy(var1, var2, var5, var6, var8, this.separationMode);
            break;
         case Push:
            this.computeSummedDistancePush(var1, var2, var5, var6, var8);
      }

      if (DebugSupport.get(var1, var6).isDebugFlagSet(RoleDebugFlags.VisSeparationSummed)) {
         World var9 = var6.getExternalData().getWorld();
         Vector3d var10 = new Vector3d(this.separationSummedDistances);
         VisHelper.renderDebugVector(var2, var10, DebugUtils.COLOR_BLACK, var9);
      }

      if (this.separationSummedCount != 0) {
         if (!(this.separationSummedDistances.lengthSquared() < 0.010000000000000002)) {
            class="kw">switch (this.separationMode) {
               case Legacy:
                  this.scaleSummedDistanceLegacy(var3, var4);
                  break;
               case Push:
                  this.scaleSummedDistancesPush(var2, var3, var4, var6);
            }

            if (this.useOrientationHint) {
               var4.setDirectionHint(var3);
            }
         }
      }
   }

   class="kw">private void computeSummedDistanceLegacy(
      @Nonnull Ref<EntityStore> var1,
      @Nonnull Vector3d var2,
      @Nonnull ComponentType<EntityStore, TransformComponent> var3,
      @Nonnull CommandBuffer<EntityStore> var4,
      @Nullable Ref<EntityStore> var5,
      Role.SeparationMode var6
   ) {
      double var7 = this.separationDistance;
      if (var5 != null && var5.isValid()) {
         TransformComponent var9 = var4.getComponent(var5, var3);
         assert var9 != null;
         double var10 = var9.getPosition().distanceSquared(var2);
         if (var10 <= this.separationNearRadiusTarget * this.separationNearRadiusTarget) {
            var7 = this.separationDistanceTarget;
         } else if (var10 < this.separationFarRadiusTarget * this.separationFarRadiusTarget) {
            double var12 = (Math.sqrt(var10) - this.separationNearRadiusTarget) / (this.separationFarRadiusTarget - this.separationNearRadiusTarget);
            var7 = NPCPhysicsMath.lerp(this.separationDistanceTarget, this.separationDistance, var12);
         }
      }

      this.groupSteeringAccumulator.setComponentSelector(this.activeMotionController.getComponentSelector());
      this.groupSteeringAccumulator.setMaxRange(var7);
      this.groupSteeringAccumulator.setViewConeHalfAngleCosine(this.collisionViewHalfAngleCosine);
      this.groupSteeringAccumulator.setNormalizeDistances(this.normalizeDistances);
      this.groupSteeringAccumulator.begin(var1, var4);
      PositionCache.get(var1, var4)
         .forEachEntityInAvoidanceRange(
            this.ignoredEntitiesForAvoidance,
            (var1x, var2x, var3x, var4x) -> var2x.processEntity(var1x, this.separationWeight, 1.0, 1.0, var4x),
            this.groupSteeringAccumulator,
            this,
            var4
         );
      this.groupSteeringAccumulator.end();
      this.separationSummedDistances.set(this.groupSteeringAccumulator.getSumOfDistances());
      this.separationSummedCount = this.groupSteeringAccumulator.getCount();
   }

   class="kw">private void scaleSummedDistanceLegacy(@Nonnull Rotation3f var1, @Nonnull Steering var2) {
      double var3 = var2.getSpeed();
      this.separationTempDistanceVector.set(this.separationSummedDistances).normalize(-this.separationLegacySteeringStrength);
      if (var3 > 0.0) {
         this.separationTempDistanceVector.add(var2.getTranslation());
         this.separationTempDistanceVector.normalize(var3);
      } else if (this.alwaysApplySeparation) {
         this.separationTempDistanceVector.add(var2.getTranslation());
      }

      this.lastSeparationSteering.set(this.separationTempDistanceVector).sub(var2.getTranslation());
      var2.setTranslation(this.separationTempDistanceVector);
   }

   class="kw">private void computeSummedDistancePush(
      @Nonnull Ref<EntityStore> var1,
      @Nonnull Vector3d var2,
      @Nonnull ComponentType<EntityStore, TransformComponent> var3,
      @Nonnull CommandBuffer<EntityStore> var4,
      @Nullable Ref<EntityStore> var5
   ) {
      double var6 = var2.x();
      double var8 = var2.y();
      double var10 = var2.z();
      BodyMotion var12 = this.getLastBodySteeringMotion();
      Ref var13 = var12 != null ? var12.getDesiredTargetEntity() : null;
      Ref var14 = var13 != null && var13.isValid() ? var13 : null;
      double var15 = var14 != null ? var12.getDesiredTargetDistance() : Double.MAX_VALUE;
      double var17 = var15 * this.separationSafeDistanceMultiplier;
      boolean var19 = var17 < this.separationDistance;
      double var20 = this.separationDistance * this.separationDistance;
      Vector3d var22;
      if (var14 != null) {
         TransformComponent var23 = var4.getComponent(var14, var3);
         assert var23 != null;
         var22 = var23.getPosition();
      } else {
         var22 = null;
      }

      PositionCache.get(var1, var4).forEachEntityInAvoidanceRange(this.ignoredEntitiesForAvoidance, (var19x, var20x, var21, var22x) -> {
         if (var1 != var19x) {
            if (var5 != var19x) {
               TransformComponent var23 = var22x.getComponent(var19x, var3);
               assert var23 != null;
               Vector3d var24 = var23.getPosition();
               double var25 = this.separationDistance;
               double var27 = this.separationPushDistanceWeightDefault;
               if (var19) {
                  if (var19x == var14) {
                     double var29 = NPCPhysicsMath.distanceSquaredWithSelector(var22, var2, var20x);
                     if (var29 <= var20) {
                        var25 = Math.max(Math.sqrt(var29) * this.separationSafeDistanceMultiplier, var17);
                        var27 = this.separationPushDistanceWeightTarget;
                     }
                  } else if (var22 != null && NPCPhysicsMath.distanceSquaredWithSelector(var24, var22, var20x) <= var20) {
                     var25 = var17;
                     var27 = this.separationPushDistanceWeightAttacker;
                  }
               }

               double var41 = (var24.x() - var6) * var20x.x;
               double var31 = (var24.y() - var8) * var20x.y;
               double var33 = (var24.z() - var10) * var20x.z;
               double var35 = NPCPhysicsMath.dotProduct(var41, var31, var33);
               if (!(var35 > var25 * var25)) {
                  double var37;
                  if (var35 < 1.0E-6) {
                     while (true) {
                        var41 = RandomExtra.randomRange(-1.0, 1.0) * var20x.x;
                        var31 = RandomExtra.randomRange(-1.0, 1.0) * var20x.y;
                        var33 = RandomExtra.randomRange(-1.0, 1.0) * var20x.z;
                        var35 = NPCPhysicsMath.dotProduct(var41, var31, var33);
                        if (!(var35 < 1.0E-6)) {
                           double var39 = 0.001 / Math.sqrt(var35);
                           var41 *= var39;
                           var31 *= var39;
                           var33 *= var39;
                           var37 = 0.001;
                           break;
                        }
                     }
                  } else {
                     var37 = Math.sqrt(var35);
                  }

                  var35 = var37 / var25;
                  var35 = 1.0 - Math.pow(var35, var27);
                  var35 /= var37;
                  var41 *= var35;
                  var31 *= var35;
                  var33 *= var35;
                  if (DebugSupport.get(var1, var4).isDebugFlagSet(RoleDebugFlags.VisSeparationTargets)) {
                     World var52 = var4.getExternalData().getWorld();
                     VisHelper.renderDebugSphere(var24, var25, var25 == this.separationDistance ? DebugUtils.COLOR_WHITE : DebugUtils.COLOR_CYAN, var52);
                     Vector3d var40 = new Vector3d(var41, var31, var33);
                     VisHelper.renderDebugVector(var2, var40, DebugUtils.COLOR_YELLOW, var52);
                  }

                  this.separationSummedDistances.add(var41, var31, var33);
                  this.separationSummedCount++;
               }
            }
         }
      }, this.activeMotionController.getComponentSelector(), this, var4);
   }

   class="kw">private void scaleSummedDistancesPush(@Nonnull Vector3d var1, @Nonnull Rotation3f var2, @Nonnull Steering var3, @Nonnull CommandBuffer<EntityStore> var4) {
      this.separationTempDistanceVector.set(this.separationSummedDistances).mul(this.activeMotionController.getComponentSelector());
      double var5 = this.separationTempDistanceVector.lengthSquared();
      if (var5 > 1.0) {
         this.separationTempDistanceVector.normalize();
      }

      this.separationTempDistanceVector.mul(-this.separationPushSteeringStrength);
      this.separationTempSteeringVector.set(var3.getTranslation()).mul(this.activeMotionController.getComponentSelector());
      double var7 = this.separationTempSteeringVector.lengthSquared();
      if (var7 < 1.0000000000000002E-10) {
         if (!this.alwaysApplySeparation) {
            class="kw">return;
         }

         var3.setTranslation(this.separationTempDistanceVector);
         this.lastSeparationSteering.set(this.separationTempDistanceVector);
      } else {
         double var9 = Math.pow(var7, this.separationPushSpeedScale * 0.5);
         this.separationTempDistanceVector.add(this.separationTempSteeringVector).normalize(var9).sub(this.separationTempSteeringVector);
         this.separationTempSteeringVector.set(var3.getTranslation()).add(this.separationTempDistanceVector);
         if (this.separationTempSteeringVector.lengthSquared() > 1.0) {
            this.separationTempSteeringVector.normalize();
         }

         var3.setTranslation(this.separationTempSteeringVector);
         this.lastSeparationSteering.set(this.separationTempDistanceVector);
      }
   }

   @Nonnull
   class="kw">public Vector3d getLastSeparationSteering() {
      class="kw">return this.lastSeparationSteering;
   }

   class="kw">public void blendAvoidance(
      @Nonnull Ref<EntityStore> var1, @Nonnull Vector3d var2, @Nonnull Rotation3f var3, @Nonnull Steering var4, @Nonnull CommandBuffer<EntityStore> var5
   ) {
      this.steeringForceAvoidCollision.setDebug(DebugSupport.get(var1, var5).isDebugRoleSteering());
      this.steeringForceAvoidCollision.setAvoidanceMode(this.avoidanceMode);
      this.steeringForceAvoidCollision.setSelf(var1, var2, var5);
      if (!this.activeMotionController.estimateVelocity(var4, this.steeringForceAvoidCollision.getSelfVelocity())) {
         this.steeringForceAvoidCollision.setVelocityFromEntity(var1, var5);
      }

      if (this.collisionRadius >= 0.0) {
         this.steeringForceAvoidCollision.setSelfRadius(this.collisionRadius);
      }

      this.steeringForceAvoidCollision.setMaxDistance(this.collisionProbeDistance);
      this.steeringForceAvoidCollision.setFalloff(this.collisionForceFalloff);
      this.steeringForceAvoidCollision.setComponentSelector(this.activeMotionController.getComponentSelector());
      this.steeringForceAvoidCollision.reset();
      PositionCache.get(var1, var5)
         .forEachEntityInAvoidanceRange(
            this.ignoredEntitiesForAvoidance, (var0, var1x, var2x) -> var1x.add(var0, var2x), this.steeringForceAvoidCollision, var5
         );
      this.steeringForceAvoidCollision.compute(var4);
   }

   @Nonnull
   class="kw">public Vector3d getLastAvoidanceSteering() {
      class="kw">return this.steeringForceAvoidCollision.getLastSteeringDirection();
   }

   class="kw">public String getRoleName() {
      class="kw">return this.roleName;
   }

   class="kw">public int getRoleIndex() {
      class="kw">return this.roleIndex;
   }

   class="kw">public void setRoleIndex(@Nonnull Holder<EntityStore> var1, int var2, @Nonnull String var3) {
      this.roleIndex = var2;
      this.roleName = var3;
      var1.getComponent(PositionCache.getComponentType()).setRoleIndex(var2);
      var1.getComponent(CombatSupport.getComponentType()).setRoleIndex(var2);
   }

   class="kw">public boolean isInvulnerable() {
      class="kw">return this.invulnerable;
   }

   class="kw">public boolean isBreathesInAir() {
      class="kw">return this.breathesInAir;
   }

   class="kw">public boolean isBreathesInWater() {
      class="kw">return this.breathesInWater;
   }

   class="kw">public double getInertia() {
      class="kw">return this.inertia;
   }

   class="kw">public double getKnockbackScale() {
      class="kw">return this.knockbackScale;
   }

   class="kw">public boolean canBreathe(@Nonnull BlockMaterial var1, int var2) {
      class="kw">return this.invulnerable ? true : this.couldBreathe(var1, var2);
   }

   class="kw">public boolean couldBreathe(@Nonnull BlockMaterial var1, int var2) {
      if (var2 != 0) {
         class="kw">return this.breathesInWater;
      } else {
         class="kw">return var1 == BlockMaterial.Empty ? this.breathesInAir : false;
      }
   }

   class="kw">public boolean couldBreatheCached(@Nonnull Ref<EntityStore> var1, @Nonnull ComponentAccessor<EntityStore> var2) {
      class="kw">return PositionCache.get(var1, var2).couldBreatheCached();
   }

   class="kw">public void addVelocity(@Nonnull Vector3d var1, @Nullable VelocityConfig var2) {
      if (this.activeMotionController != null) {
         this.activeMotionController.addVelocity(var1, var2);
      }
   }

   class="kw">public void setVelocity(@Nonnull Vector3d var1, @Nullable VelocityConfig var2, boolean var3) {
      if (this.activeMotionController != null) {
         this.activeMotionController.setVelocity(var1, var2, var3);
      }
   }

   class="kw">public void processAddVelocityInstruction(@Nonnull Vector3d var1, @Nullable VelocityConfig var2) {
      if (this.activeMotionController != null) {
         this.activeMotionController.addVelocity(var1, var2);
      }
   }

   class="kw">public void processSetVelocityInstruction(@Nonnull Vector3d var1, @Nullable VelocityConfig var2) {
      if (this.activeMotionController != null) {
         this.activeMotionController.setVelocity(Vector3dUtil.ZERO, null, false);
         this.activeMotionController.addVelocity(var1, var2);
      }
   }

   class="kw">public boolean isOnGround() {
      class="kw">return this.activeMotionController != null && this.activeMotionController.onGround();
   }

   class="kw">public void setArmor(@Nonnull NPCEntity var1, @Nullable String[] var2) {
      this.armor = var2;
   }

   class="kw">public boolean isPickupDropOnDeath() {
      class="kw">return this.pickupDropOnDeath;
   }

   class="kw">public boolean requiresLeashPosition() {
      class="kw">return this.requiresLeashPosition;
   }

   class="kw">public void clearOnce(@Nonnull Ref<EntityStore> var1, @Nonnull ComponentAccessor<EntityStore> var2) {
      this.rootInstruction.clearOnce();
      if (this.interactionInstruction != null) {
         this.interactionInstruction.clearOnce();
      }

      if (this.deathInstruction != null) {
         this.deathInstruction.clearOnce();
      }

      StateSupport.get(var1, var2).pollNeedClearOnce();
   }

   class="kw">public void clearOnceIfNeeded(@Nonnull Ref<EntityStore> var1, @Nonnull ComponentAccessor<EntityStore> var2) {
      StateSupport var3 = StateSupport.get(var1, var2);
      if (var3.pollNeedClearOnce()) {
         this.clearOnce(var1, var2);
         var3.resetLocalStateMachines();
      }
   }

   class="kw">public void setMarkedTarget(
      @Nonnull Ref<EntityStore> var1, @Nonnull ComponentAccessor<EntityStore> var2, @Nonnull String var3, @Nonnull Ref<EntityStore> var4
   ) {
      MarkedEntitySupport.get(var1, var2).setMarkedEntity(var3, var4);
   }

   class="kw">public boolean isIgnoredForAvoidance(@Nonnull Ref<EntityStore> var1) {
      class="kw">return this.ignoredEntitiesForAvoidance.contains(var1);
   }

   class="kw">public Role.AvoidanceMode getAvoidanceMode() {
      class="kw">return this.avoidanceMode;
   }

   class="kw">public double getCollisionRadius() {
      class="kw">return this.collisionRadius;
   }

   class="kw">public int[] getFlockSpawnTypes() {
      if (this.flockSpawnTypeIndices != null) {
         class="kw">return this.flockSpawnTypeIndices;
      }

      int var1 = this.flockSpawnTypes == null ? 0 : this.flockSpawnTypes.length;
      this.flockSpawnTypeIndices = new int[var1];

      for (int var2 = 0; var2 < var1; var2++) {
         String var3 = this.flockSpawnTypes[var2];
         int var4 = NPCPlugin.get().getIndex(var3);
         if (var4 == Integer.MIN_VALUE) {
            throw new IllegalStateException(String.format("Role %s contains unknown FlockSpawnTypes NPC %s", this.roleName, var3));
         }

         this.flockSpawnTypeIndices[var2] = var4;
      }

      class="kw">return this.flockSpawnTypeIndices;
   }

   @Nonnull
   class="kw">public String[] getFlockAllowedRoles() {
      class="kw">return this.flockAllowedRoles != null ? Arrays.copyOf(this.flockAllowedRoles, this.flockAllowedRoles.length) : ArrayUtil.EMPTY_STRING_ARRAY;
   }

   class="kw">public boolean isFlockSpawnTypesRandom() {
      class="kw">return this.flockSpawnTypesRandom;
   }

   class="kw">public boolean isCanLeadFlock() {
      class="kw">return this.canLeadFlock;
   }

   class="kw">public double getFlockInfluenceRange() {
      class="kw">return this.flockInfluenceRange;
   }

   class="kw">public double getDeathAnimationTime() {
      class="kw">return this.deathAnimationTime;
   }

   @Nullable
   class="kw">public String getDeathParticles() {
      class="kw">return this.deathParticles;
   }

   class="kw">public boolean isDropDeathItemsInstantly() {
      class="kw">return this.dropDeathItemsInstantly;
   }

   class="kw">public boolean hasDroppedDeathItems() {
      class="kw">return this.deathItemsDropped;
   }

   class="kw">public void setDeathItemsDropped() {
      this.deathItemsDropped = true;
   }

   @Nullable
   class="kw">public String getDeathInteraction() {
      class="kw">return this.deathInteraction;
   }

   class="kw">public float getDespawnAnimationTime() {
      class="kw">return this.despawnAnimationTime;
   }

   class="kw">public void setReachedTerminalAction(boolean var1) {
      this.hasReachedTerminalAction = var1;
   }

   class="kw">public boolean hasReachedTerminalAction() {
      class="kw">return this.hasReachedTerminalAction;
   }

   class="kw">public boolean isBackingAway() {
      class="kw">return this.backingAway;
   }

   class="kw">public void setBackingAway(boolean var1) {
      this.backingAway = var1;
   }

   @Nullable
   class="kw">public String getSteeringMotionName() {
      BodyMotion var1 = this.getLastBodySteeringMotion();
      class="kw">return var1 == null ? null : var1.getClass().getSimpleName();
   }

   @Nullable
   class="kw">public BodyMotion getLastBodySteeringMotion() {
      if (this.lastBodyMotionStep == null) {
         class="kw">return null;
      }

      BodyMotion var1 = this.lastBodyMotionStep.getBodyMotion();
      class="kw">return var1 == null ? null : var1.getSteeringMotion();
   }

   @Nullable
   class="kw">public EnumSet<RelaxedConstraint> getSteeringRelaxedConstraints() {
      BodyMotion var1 = this.getLastBodySteeringMotion();
      class="kw">return var1 == null ? null : var1.getRelaxedConstraints();
   }

   @Override
   class="kw">public int componentCount() {
      class="kw">return 1;
   }

   @Override
   class="kw">public IAnnotatedComponent getComponent(int var1) {
      class="kw">return this.rootInstruction;
   }

   @Override
   class="kw">public void getInfo(ExecutionSupport var1, ComponentInfo var2) {
   }

   @Override
   class="kw">public int getIndex() {
      throw new UnsupportedOperationException("Roles do not have component indexes!");
   }

   @Override
   class="kw">public void setContext(IAnnotatedComponent var1, int var2) {
      throw new UnsupportedOperationException("Roles do not have parent contexts!");
   }

   @Nullable
   @Override
   class="kw">public IAnnotatedComponent getParent() {
      class="kw">return null;
   }

   @Override
   class="kw">public String getLabel() {
      class="kw">return this.roleName;
   }

   class="kw">private void initialiseInventories(@Nonnull NPCEntity var1, @Nonnull Holder<EntityStore> var2, @Nonnull Store<EntityStore> var3) {
      List var4 = null;
      if (this.inventoryContentsDropList != null) {
         ItemModule var5 = ItemModule.get();
         if (var5.isEnabled()) {
            var4 = var5.getRandomItemDrops(this.inventoryContentsDropList);
         }
      }

      int var10 = var4 != null && var4.size() > this.inventorySlots ? var4.size() : this.inventorySlots;
      if (var10 > 0 || this.hotbarSlots > 3 || this.offHandSlots > 0) {
         ObjectArrayList var6 = new ObjectArrayList();
         InventoryComponent.Hotbar var7 = var2.getComponent(InventoryComponent.Hotbar.getComponentType());
         if (var7 != null) {
            var7.ensureCapacity((short)this.hotbarSlots, var6);
         }

         InventoryComponent.Utility var8 = var2.getComponent(InventoryComponent.Utility.getComponentType());
         if (var8 != null) {
            var8.ensureCapacity((short)this.offHandSlots, var6);
         }

         InventoryComponent.Storage var9 = var2.getComponent(InventoryComponent.Storage.getComponentType());
         if (var9 != null) {
            var9.ensureCapacity((short)var10, var6);
         }
      }

      if (var4 != null) {
         InventoryComponent.Storage var11 = var2.getComponent(InventoryComponent.Storage.getComponentType());
         if (var11 != null) {
            for (ItemStack var14 : var4) {
               var11.getInventory().addItemStack(var14);
            }
         }
      }

      this.initialiseItemsAndArmor(var2, var1, var3);
      if (this.defaultOffHandSlot >= 0) {
         InventoryComponent.Utility var12 = var2.getComponent(InventoryComponent.Utility.getComponentType());
         if (var12 != null && this.defaultOffHandSlot != var12.getActiveSlot() && this.defaultOffHandSlot < var12.getInventory().getCapacity()) {
            var12.setActiveSlot(this.defaultOffHandSlot, var2, var3);
         }
      }
   }

   class="kw">private void initialiseInventories(@Nonnull NPCEntity var1, @Nonnull ComponentAccessor<EntityStore> var2, @Nonnull Ref<EntityStore> var3) {
      List var4 = null;
      if (this.inventoryContentsDropList != null) {
         ItemModule var5 = ItemModule.get();
         if (var5.isEnabled()) {
            var4 = var5.getRandomItemDrops(this.inventoryContentsDropList);
         }
      }

      int var10 = var4 != null && var4.size() > this.inventorySlots ? var4.size() : this.inventorySlots;
      if (var10 > 0 || this.hotbarSlots > 3 || this.offHandSlots > 0) {
         ObjectArrayList var6 = new ObjectArrayList();
         InventoryComponent.Hotbar var7 = var2.getComponent(var3, InventoryComponent.Hotbar.getComponentType());
         if (var7 != null) {
            var7.ensureCapacity((short)this.hotbarSlots, var6);
         }

         InventoryComponent.Utility var8 = var2.getComponent(var3, InventoryComponent.Utility.getComponentType());
         if (var8 != null) {
            var8.ensureCapacity((short)this.offHandSlots, var6);
         }

         InventoryComponent.Storage var9 = var2.getComponent(var3, InventoryComponent.Storage.getComponentType());
         if (var9 != null) {
            var9.ensureCapacity((short)var10, var6);
         }
      }

      if (var4 != null) {
         InventoryComponent.Storage var11 = var2.getComponent(var3, InventoryComponent.Storage.getComponentType());
         if (var11 != null) {
            for (ItemStack var13 : var4) {
               var11.getInventory().addItemStack(var13);
            }
         }
      }

      this.initialiseInventories(var3, var1, var2);
   }

   class="kw">private void initialiseItemsAndArmor(@Nonnull Holder<EntityStore> var1, @Nonnull NPCEntity var2, @Nonnull Store<EntityStore> var3) {
      if (this.hotbarItems != null && this.hotbarItems.length > 0) {
         InventoryComponent.Hotbar var4 = var1.getComponent(InventoryComponent.Hotbar.getComponentType());
         if (var4 != null && var4.getInventory().isEmpty()) {
            ItemContainer var5 = var4.getInventory();

            for (byte var6 = 0; var6 < this.hotbarItems.length; var6++) {
               String var7 = this.hotbarItems[var6];
               if (var7 != null) {
                  if (var7.startsWith("Droplist:")) {
                     if (var6 >= var5.getCapacity()) {
                        NPCPlugin.get().getLogger().at(Level.WARNING).log("Invalid hotbar slot %s. Max is %s", var6, var5.getCapacity() - 1);
                     } else {
                        List var8 = ItemModule.get().getRandomItemDrops(var7.substring("Droplist:".length()));
                        var5.setItemStackForSlot(var6, var8.get(RandomExtra.randomRange(var8.size())));
                     }
                  } else if (InventoryHelper.itemKeyExists(var7) && var6 < var5.getCapacity() && !InventoryHelper.matchesItem(var7, var5.getItemStack(var6))) {
                     ItemStack var17 = InventoryHelper.createItem(var7);
                     var5.setItemStackForSlot(var6, var17);
                  }
               }
            }
         }
      }

      if (this.offHandItems != null && this.offHandItems.length > 0) {
         InventoryComponent.Utility var9 = var1.getComponent(InventoryComponent.Utility.getComponentType());
         if (var9 != null) {
            ItemContainer var11 = var9.getInventory();

            for (byte var13 = 0; var13 < this.offHandItems.length; var13++) {
               String var15 = this.offHandItems[var13];
               if (InventoryHelper.itemKeyExists(var15) && var13 < var11.getCapacity() && !InventoryHelper.matchesItem(var15, var11.getItemStack(var13))) {
                  var11.setItemStackForSlot(var13, InventoryHelper.createItem(var15));
               }
            }
         }
      }

      if (this.armor != null) {
         InventoryComponent.Armor var10 = var1.getComponent(InventoryComponent.Armor.getComponentType());
         if (var10 != null) {
            for (String var18 : this.armor) {
               if (!InventoryHelper.useArmor(var10.getInventory(), var18)) {
                  NPCPlugin.get().getLogger().at(Level.WARNING).log("NPC of type '%s': Failed to use armor '%s'", var2.getRoleName(), var18);
               }
            }
         }
      }
   }

   class="kw">private void initialiseItemsAndArmor(@Nonnull Ref<EntityStore> var1, @Nonnull NPCEntity var2, @Nonnull ComponentAccessor<EntityStore> var3) {
      if (this.hotbarItems != null && this.hotbarItems.length > 0) {
         InventoryComponent.Hotbar var4 = var3.getComponent(var1, InventoryComponent.Hotbar.getComponentType());
         if (var4 != null && var4.getInventory().isEmpty()) {
            for (byte var5 = 0; var5 < this.hotbarItems.length; var5++) {
               String var6 = this.hotbarItems[var5];
               if (var6 != null) {
                  if (var6.startsWith("Droplist:")) {
                     if (InventoryHelper.checkHotbarSlot(var1, var5, var3)) {
                        List var7 = ItemModule.get().getRandomItemDrops(var6.substring("Droplist:".length()));
                        var4.getInventory().setItemStackForSlot(var5, var7.get(RandomExtra.randomRange(var7.size())));
                     }
                  } else {
                     InventoryHelper.setHotbarItem(var1, var6, var5, var3);
                  }
               }
            }
         }
      }

      if (this.offHandItems != null && this.offHandItems.length > 0) {
         for (byte var9 = 0; var9 < this.offHandItems.length; var9++) {
            InventoryHelper.setOffHandItem(var1, this.offHandItems[var9], var9, var3);
         }
      }

      if (this.armor != null) {
         InventoryComponent.Armor var10 = var3.getComponent(var1, InventoryComponent.Armor.getComponentType());
         if (var10 != null) {
            for (String var8 : this.armor) {
               if (!InventoryHelper.useArmor(var10.getInventory(), var8)) {
                  NPCPlugin.get().getLogger().at(Level.WARNING).log("NPC of type '%s': Failed to use armor '%s'", var2.getRoleName(), var8);
               }
            }
         }
      }
   }

   class="kw">private void initialiseInventories(@Nonnull Ref<EntityStore> var1, @Nonnull NPCEntity var2, @Nonnull ComponentAccessor<EntityStore> var3) {
      this.initialiseItemsAndArmor(var1, var2, var3);
      if (this.defaultOffHandSlot >= 0) {
         InventoryHelper.setOffHandSlot(var1, this.defaultOffHandSlot, var3);
      }
   }

   class="kw">public boolean isCorpseStaysInFlock() {
      class="kw">return this.corpseStaysInFlock;
   }

   class="kw">public void onLoadFromWorldGenOrPrefab(@Nonnull Ref<EntityStore> var1, @Nonnull NPCEntity var2, @Nonnull ComponentAccessor<EntityStore> var3) {
      var3.getComponent(var1, DisplayNameSupport.getComponentType()).pickRandomDisplayName(var1, true, var3);
      this.initialiseInventories(var2, var3, var1);
   }

   class="kw">public enum AvoidanceMode class="kw">implements Supplier<String> {
      Slowdown("Only slow down NPC"),
      Evade("Only evade"),
      Any("Any avoidance allowed");

      @Nonnull
      class="kw">private class="kw">final String description;

      AvoidanceMode(@Nonnull class="kw">final String nullxx) {
         this.description = nullxx;
      }

      @Nonnull
      class="kw">public String get() {
         class="kw">return this.description;
      }
   }

   class="kw">public enum SeparationMode class="kw">implements Supplier<String> {
      Legacy("Flock like separation force"),
      Push("Push away from all neighbours and also applied when no other steering happens");

      class="kw">private class="kw">final String description;

      SeparationMode(String nullxx) {
         this.description = nullxx;
      }

      class="kw">public String get() {
         class="kw">return this.description;
      }
   }
}