ExecutionSupport class

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

Файл: com/hypixel/hytale/server/npc/instructions/ExecutionSupport.java

Поля (5)

МодификаторыТипИмя
final ThreadLocal<List<ExecutionSupport>> POOL
List var0
ExecutionSupport var1
NPCEntity var1
Instruction var2

Методы (21)

МодификаторыВозвратСигнатура
public void clearForReusevoid clearForReuse()
public int getRoleIndexint getRoleIndex()
if if(this.stateSupport == null && this.currentRef != null && this.currentAccessor != null)
if if(this.markedEntitySupport == null && this.currentRef != null && this.currentAccessor != null)
if if(this.worldSupport == null && this.currentRef != null && this.currentAccessor != null)
if if(this.entitySupport == null && this.currentRef != null && this.currentAccessor != null)
if if(this.positionCache == null && this.currentRef != null && this.currentAccessor != null)
if if(this.debugSupport == null && this.currentRef != null && this.currentAccessor != null)
if if(this.flagsComponent == null && this.currentRef != null && this.currentAccessor != null)
if if(this.combatSupport == null && this.currentRef != null && this.currentAccessor != null)
if if(this.motionContextSupport == null && this.currentRef != null && this.currentAccessor != null)
if if(this.displayNameSupport == null && this.currentRef != null && this.currentAccessor != null)
if if(this.playerTaskSupport == null && this.currentRef != null && this.currentAccessor != null)
if if(this.currentTreeModeStep != null)
if if(this.inUse)
public void notifySensorMatchvoid notifySensorMatch()
public void populateFromEntityvoid populateFromEntity(@Nonnull Ref<EntityStore> var1, @Nonnull ComponentAccessor<EntityStore> var2)
public void populateFromHoldervoid populateFromHolder(@Nonnull Holder<EntityStore> var1)
public void setIndexedInstructionsvoid setIndexedInstructions(@Nullable IndexedInstructions var1)
public void setNamevoid setName(@Nullable String var1)
public void setRoleIndexvoid setRoleIndex(int var1)

Исходный код

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

class="kw">import com.hypixel.hytale.component.ComponentAccessor;
class="kw">import com.hypixel.hytale.component.Holder;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import com.hypixel.hytale.server.npc.entities.NPCEntity;
class="kw">import com.hypixel.hytale.server.npc.role.Role;
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 java.util.ArrayList;
class="kw">import java.util.List;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;

class="kw">public class="kw">final class ExecutionSupport {
   class="kw">private class="kw">static class="kw">final ThreadLocal<List<ExecutionSupport>> POOL = ThreadLocal.withInitial(ArrayList::new);
   @Nullable
   class="kw">private StateSupport stateSupport;
   @Nullable
   class="kw">private MarkedEntitySupport markedEntitySupport;
   @Nullable
   class="kw">private WorldSupport worldSupport;
   @Nullable
   class="kw">private EntitySupport entitySupport;
   @Nullable
   class="kw">private PositionCache positionCache;
   @Nullable
   class="kw">private DebugSupport debugSupport;
   @Nullable
   class="kw">private FlagsComponent flagsComponent;
   @Nullable
   class="kw">private CombatSupport combatSupport;
   @Nullable
   class="kw">private MotionContextSupport motionContextSupport;
   @Nullable
   class="kw">private DisplayNameSupport displayNameSupport;
   @Nullable
   class="kw">private PlayerTaskSupport playerTaskSupport;
   class="kw">private boolean inUse;
   @Nullable
   class="kw">private Instruction currentTreeModeStep;
   class="kw">private int roleIndex = -1;
   @Nullable
   class="kw">private String name;
   @Nullable
   class="kw">private IndexedInstructions indexedInstructions;
   @Nullable
   class="kw">private Ref<EntityStore> currentRef;
   @Nullable
   class="kw">private ComponentAccessor<EntityStore> currentAccessor;

   class="kw">public ExecutionSupport() {
   }

   @Nonnull
   class="kw">public class="kw">static ExecutionSupport acquire() {
      List var0 = POOL.get();
      ExecutionSupport var1 = var0.isEmpty() ? new ExecutionSupport() : var0.removeLast();
      assert !var1.inUse : "ExecutionSupport pool invariant violated: pooled instance was already in use";
      var1.inUse = true;
      class="kw">return var1;
   }

   @Nonnull
   class="kw">public StateSupport getStateSupport() {
      if (this.stateSupport == null && this.currentRef != null && this.currentAccessor != null) {
         this.stateSupport = this.currentAccessor.getComponent(this.currentRef, StateSupport.getComponentType());
      }

      assert this.stateSupport != null : "Missing StateSupport on entity " + this.currentRef;
      class="kw">return this.stateSupport;
   }

   @Nonnull
   class="kw">public MarkedEntitySupport getMarkedEntitySupport() {
      if (this.markedEntitySupport == null && this.currentRef != null && this.currentAccessor != null) {
         this.markedEntitySupport = this.currentAccessor.getComponent(this.currentRef, MarkedEntitySupport.getComponentType());
      }

      assert this.markedEntitySupport != null : "Missing MarkedEntitySupport on entity " + this.currentRef;
      class="kw">return this.markedEntitySupport;
   }

   @Nonnull
   class="kw">public WorldSupport getWorldSupport() {
      if (this.worldSupport == null && this.currentRef != null && this.currentAccessor != null) {
         this.worldSupport = this.currentAccessor.getComponent(this.currentRef, WorldSupport.getComponentType());
      }

      assert this.worldSupport != null : "Missing WorldSupport on entity " + this.currentRef;
      class="kw">return this.worldSupport;
   }

   @Nonnull
   class="kw">public EntitySupport getEntitySupport() {
      if (this.entitySupport == null && this.currentRef != null && this.currentAccessor != null) {
         this.entitySupport = this.currentAccessor.getComponent(this.currentRef, EntitySupport.getComponentType());
      }

      assert this.entitySupport != null : "Missing EntitySupport on entity " + this.currentRef;
      class="kw">return this.entitySupport;
   }

   @Nonnull
   class="kw">public PositionCache getPositionCache() {
      if (this.positionCache == null && this.currentRef != null && this.currentAccessor != null) {
         this.positionCache = this.currentAccessor.getComponent(this.currentRef, PositionCache.getComponentType());
      }

      assert this.positionCache != null : "Missing PositionCache on entity " + this.currentRef;
      class="kw">return this.positionCache;
   }

   @Nonnull
   class="kw">public DebugSupport getDebugSupport() {
      if (this.debugSupport == null && this.currentRef != null && this.currentAccessor != null) {
         this.debugSupport = this.currentAccessor.getComponent(this.currentRef, DebugSupport.getComponentType());
      }

      assert this.debugSupport != null : "Missing DebugSupport on entity " + this.currentRef;
      class="kw">return this.debugSupport;
   }

   @Nonnull
   class="kw">public FlagsComponent getFlagsComponent() {
      if (this.flagsComponent == null && this.currentRef != null && this.currentAccessor != null) {
         this.flagsComponent = this.currentAccessor.getComponent(this.currentRef, FlagsComponent.getComponentType());
      }

      assert this.flagsComponent != null : "Missing FlagsComponent on entity " + this.currentRef;
      class="kw">return this.flagsComponent;
   }

   @Nonnull
   class="kw">public CombatSupport getCombatSupport() {
      if (this.combatSupport == null && this.currentRef != null && this.currentAccessor != null) {
         this.combatSupport = this.currentAccessor.getComponent(this.currentRef, CombatSupport.getComponentType());
      }

      assert this.combatSupport != null : "Missing CombatSupport on entity " + this.currentRef;
      class="kw">return this.combatSupport;
   }

   @Nonnull
   class="kw">public MotionContextSupport getMotionContextSupport() {
      if (this.motionContextSupport == null && this.currentRef != null && this.currentAccessor != null) {
         this.motionContextSupport = this.currentAccessor.getComponent(this.currentRef, MotionContextSupport.getComponentType());
      }

      assert this.motionContextSupport != null : "Missing MotionContextSupport on entity " + this.currentRef;
      class="kw">return this.motionContextSupport;
   }

   @Nonnull
   class="kw">public DisplayNameSupport getDisplayNameSupport() {
      if (this.displayNameSupport == null && this.currentRef != null && this.currentAccessor != null) {
         this.displayNameSupport = this.currentAccessor.getComponent(this.currentRef, DisplayNameSupport.getComponentType());
      }

      assert this.displayNameSupport != null : "Missing DisplayNameSupport on entity " + this.currentRef;
      class="kw">return this.displayNameSupport;
   }

   @Nonnull
   class="kw">public PlayerTaskSupport getPlayerTaskSupport() {
      if (this.playerTaskSupport == null && this.currentRef != null && this.currentAccessor != null) {
         this.playerTaskSupport = this.currentAccessor.getComponent(this.currentRef, PlayerTaskSupport.getComponentType());
      }

      assert this.playerTaskSupport != null : "Missing PlayerTaskSupport on entity " + this.currentRef;
      class="kw">return this.playerTaskSupport;
   }

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

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

   @Nullable
   class="kw">public Role getRole() {
      NPCEntity var1 = this.getNpcEntity();
      class="kw">return var1 != null ? var1.getRole() : null;
   }

   @Nullable
   class="kw">public NPCEntity getNpcEntity() {
      class="kw">return this.currentRef != null && this.currentAccessor != null ? this.currentAccessor.getComponent(this.currentRef, NPCEntity.getComponentType()) : null;
   }

   @Nullable
   class="kw">public Instruction swapTreeModeSteps(@Nullable Instruction var1) {
      Instruction var2 = this.currentTreeModeStep;
      this.currentTreeModeStep = var1;
      class="kw">return var2;
   }

   class="kw">public void notifySensorMatch() {
      if (this.currentTreeModeStep != null) {
         this.currentTreeModeStep.notifyChildSensorMatch();
      }
   }

   class="kw">public void populateFromEntity(@Nonnull Ref<EntityStore> var1, @Nonnull ComponentAccessor<EntityStore> var2) {
      this.currentRef = var1;
      this.currentAccessor = var2;
      this.combatSupport = null;
      this.stateSupport = null;
      this.markedEntitySupport = null;
      this.worldSupport = null;
      this.entitySupport = null;
      this.motionContextSupport = null;
      this.displayNameSupport = null;
      this.playerTaskSupport = null;
      this.positionCache = null;
      this.debugSupport = null;
      this.flagsComponent = null;
   }

   class="kw">public void populateFromHolder(@Nonnull Holder<EntityStore> var1) {
      this.currentRef = null;
      this.currentAccessor = null;
      this.combatSupport = var1.getComponent(CombatSupport.getComponentType());
      this.stateSupport = var1.getComponent(StateSupport.getComponentType());
      this.markedEntitySupport = var1.getComponent(MarkedEntitySupport.getComponentType());
      this.worldSupport = var1.getComponent(WorldSupport.getComponentType());
      this.entitySupport = var1.getComponent(EntitySupport.getComponentType());
      this.motionContextSupport = var1.getComponent(MotionContextSupport.getComponentType());
      this.displayNameSupport = var1.getComponent(DisplayNameSupport.getComponentType());
      this.playerTaskSupport = var1.getComponent(PlayerTaskSupport.getComponentType());
      this.positionCache = var1.getComponent(PositionCache.getComponentType());
      this.debugSupport = var1.getComponent(DebugSupport.getComponentType());
      this.flagsComponent = var1.getComponent(FlagsComponent.getComponentType());
      assert this.stateSupport != null : "Missing StateSupport on holder";
      assert this.markedEntitySupport != null : "Missing MarkedEntitySupport on holder";
      assert this.worldSupport != null : "Missing WorldSupport on holder";
      assert this.entitySupport != null : "Missing EntitySupport on holder";
      assert this.positionCache != null : "Missing PositionCache on holder";
      assert this.debugSupport != null : "Missing DebugSupport on holder";
      assert this.flagsComponent != null : "Missing FlagsComponent on holder";
   }

   class="kw">public void setRoleIndex(int var1) {
      this.roleIndex = var1;
   }

   class="kw">public void setName(@Nullable String var1) {
      this.name = var1;
   }

   @Nullable
   class="kw">public IndexedInstructions getIndexedInstructions() {
      class="kw">return this.indexedInstructions;
   }

   class="kw">public void setIndexedInstructions(@Nullable IndexedInstructions var1) {
      this.indexedInstructions = var1;
   }

   class="kw">public void clearForReuse() {
      this.currentRef = null;
      this.currentAccessor = null;
      this.combatSupport = null;
      this.stateSupport = null;
      this.markedEntitySupport = null;
      this.worldSupport = null;
      this.entitySupport = null;
      this.motionContextSupport = null;
      this.displayNameSupport = null;
      this.playerTaskSupport = null;
      this.positionCache = null;
      this.debugSupport = null;
      this.flagsComponent = null;
      this.currentTreeModeStep = null;
      this.roleIndex = -1;
      this.name = null;
      this.indexedInstructions = null;
      if (this.inUse) {
         this.inUse = false;
         POOL.get().add(this);
      }
   }
}