TickHeldInteractionsSystem class

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

Файл: com/hypixel/hytale/server/npc/systems/NPCInteractionSystems.java

extends: EntityTickingSystem<EntityStore>

Поля (7)

МодификаторыТипИмя
private final ComponentType<EntityStore, InteractionManager> interactionManagerComponentType
private final ComponentType<EntityStore, NPCEntity> npcComponentType
private final Query<EntityStore> query
InteractionManager var6
Ref var7
InventoryComponent.Armor var8
ItemContainer var9

Методы (4)

МодификаторыВозвратСигнатура
abstract for for(short var10 = 0; var10 < var9.getCapacity()
public Query<EntityStore> getQuerypublic Query<EntityStore> getQuery()
if if(var8 != null)
public void tickpublic void tick(float var1, int var2, @Nonnull ArchetypeChunk<EntityStore> var3, @Nonnull Store<EntityStore> var4, @Nonnull CommandBuffer<EntityStore> var5)

Исходный код

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

class="kw">import com.hypixel.hytale.component.AddReason;
class="kw">import com.hypixel.hytale.component.ArchetypeChunk;
class="kw">import com.hypixel.hytale.component.CommandBuffer;
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.RemoveReason;
class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.component.query.Query;
class="kw">import com.hypixel.hytale.component.system.HolderSystem;
class="kw">import com.hypixel.hytale.component.system.tick.EntityTickingSystem;
class="kw">import com.hypixel.hytale.protocol.InteractionType;
class="kw">import com.hypixel.hytale.server.core.entity.InteractionManager;
class="kw">import com.hypixel.hytale.server.core.inventory.InventoryComponent;
class="kw">import com.hypixel.hytale.server.core.inventory.container.ItemContainer;
class="kw">import com.hypixel.hytale.server.core.modules.interaction.InteractionModule;
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.interactions.NPCInteractionSimulationHandler;
class="kw">import javax.annotation.Nonnull;

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

   class="kw">public class="kw">static class AddSimulationManagerSystem class="kw">extends HolderSystem<EntityStore> {
      @Nonnull
      class="kw">private class="kw">final ComponentType<EntityStore, NPCEntity> npcEntityComponentType;
      @Nonnull
      class="kw">private class="kw">final Query<EntityStore> query;

      class="kw">public AddSimulationManagerSystem(@Nonnull ComponentType<EntityStore, NPCEntity> var1) {
         this.npcEntityComponentType = var1;
         this.query = Query.and(var1, Query.not(InteractionModule.get().getInteractionManagerComponent()));
      }

      @Override
      class="kw">public void onEntityAdd(@Nonnull Holder<EntityStore> var1, @Nonnull AddReason var2, @Nonnull Store<EntityStore> var3) {
         NPCEntity var4 = var1.getComponent(this.npcEntityComponentType);
         assert var4 != null;
         var1.addComponent(InteractionModule.get().getInteractionManagerComponent(), new InteractionManager(null, new NPCInteractionSimulationHandler()));
      }

      @Override
      class="kw">public void onEntityRemoved(@Nonnull Holder<EntityStore> var1, @Nonnull RemoveReason var2, @Nonnull Store<EntityStore> var3) {
      }

      @Nonnull
      @Override
      class="kw">public Query<EntityStore> getQuery() {
         class="kw">return this.query;
      }
   }

   class="kw">public class="kw">static class TickHeldInteractionsSystem class="kw">extends EntityTickingSystem<EntityStore> {
      @Nonnull
      class="kw">private class="kw">final ComponentType<EntityStore, NPCEntity> npcComponentType;
      @Nonnull
      class="kw">private class="kw">final ComponentType<EntityStore, InteractionManager> interactionManagerComponentType;
      @Nonnull
      class="kw">private class="kw">final Query<EntityStore> query;

      class="kw">public TickHeldInteractionsSystem(@Nonnull ComponentType<EntityStore, NPCEntity> var1) {
         this.npcComponentType = var1;
         this.interactionManagerComponentType = InteractionModule.get().getInteractionManagerComponent();
         this.query = Query.and(var1, this.interactionManagerComponentType);
      }

      @Override
      class="kw">public void tick(
         float var1, int var2, @Nonnull ArchetypeChunk<EntityStore> var3, @Nonnull Store<EntityStore> var4, @Nonnull CommandBuffer<EntityStore> var5
      ) {
         InteractionManager var6 = var3.getComponent(var2, this.interactionManagerComponentType);
         assert var6 != null;
         Ref var7 = var3.getReferenceTo(var2);
         var6.tryRunHeldInteraction(var7, var5, InteractionType.Held);
         var6.tryRunHeldInteraction(var7, var5, InteractionType.HeldOffhand);
         InventoryComponent.Armor var8 = var3.getComponent(var2, InventoryComponent.Armor.getComponentType());
         if (var8 != null) {
            ItemContainer var9 = var8.getInventory();

            for (short var10 = 0; var10 < var9.getCapacity(); var10++) {
               var6.tryRunHeldInteraction(var7, var5, InteractionType.Equipped, var10);
            }
         }
      }

      @Nonnull
      @Override
      class="kw">public Query<EntityStore> getQuery() {
         class="kw">return this.query;
      }
   }
}