EntityEventView class

Пакет: com.hypixel.hytale.server.npc.blackboard.view.event.entity

Файл: com/hypixel/hytale/server/npc/blackboard/view/event/entity/EntityEventView.java

extends: EventView<EntityEventView, EntityEventType, EntityEventNotification>

Поля (18)

МодификаторыТипИмя
return
FlockMembership var12
Ref var13
World var3
Store var3
Blackboard var4
Ref var4
NPCEntity var5
int var5
var5
var5
TransformComponent var6
NPCEntity var6
IntSet var7
Vector3d var7
TransformComponent var7
Vector3d var8
Store var9

Методы (9)

МодификаторыВозвратСигнатура
for for(EntityEventType var5 : EntityEventType.VALUES)
for for(EntityEventType var6 : EntityEventType.VALUES)
public EntityEventView getUpdatedViewEntityEventView getUpdatedView(@Nonnull Ref<EntityStore> var1, @Nonnull ComponentAccessor<EntityStore> var2)
if if(var7 != null)
if if(var5 != null)
if if(var6 == null)
public void onEntityUseEntityvoid onEntityUseEntity(@Nonnull Ref<EntityStore> var1, @Nonnull UseEntityEvent.Post var2)
protected void onEventvoid onEvent(int var1, double var2, double var4, double var6, Ref<EntityStore> var8, @Nonnull Ref<EntityStore> var9, @Nonnull ComponentAccessor<EntityStore> var10, EntityEventType var11)
public void processAttackedEventvoid processAttackedEvent(@Nonnull Ref<EntityStore> var1, @Nonnull Ref<EntityStore> var2, @Nonnull ComponentAccessor<EntityStore> var3, @Nonnull EntityEventType var4)

Исходный код

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

class="kw">import com.hypixel.hytale.builtin.tagset.TagSetPlugin;
class="kw">import com.hypixel.hytale.builtin.tagset.config.NPCGroup;
class="kw">import com.hypixel.hytale.component.ComponentAccessor;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.protocol.InteractionType;
class="kw">import com.hypixel.hytale.server.core.entity.entities.Player;
class="kw">import com.hypixel.hytale.server.core.event.events.ecs.UseEntityEvent;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
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.flock.FlockMembership;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.BuilderManager;
class="kw">import com.hypixel.hytale.server.npc.blackboard.Blackboard;
class="kw">import com.hypixel.hytale.server.npc.blackboard.BlackboardSubscription;
class="kw">import com.hypixel.hytale.server.npc.blackboard.view.event.EntityEventNotification;
class="kw">import com.hypixel.hytale.server.npc.blackboard.view.event.EventTypeRegistration;
class="kw">import com.hypixel.hytale.server.npc.blackboard.view.event.EventView;
class="kw">import com.hypixel.hytale.server.npc.entities.NPCEntity;
class="kw">import com.hypixel.hytale.server.npc.util.EntityDetectionUtil;
class="kw">import it.unimi.dsi.fastutil.ints.IntSet;
class="kw">import javax.annotation.Nonnull;
class="kw">import org.joml.Vector3d;

class="kw">public class EntityEventView class="kw">extends EventView<EntityEventView, EntityEventType, EntityEventNotification> {
   class="kw">public EntityEventView(@Nonnull World var1) {
      super(EntityEventType.class, EntityEventType.VALUES, new EntityEventNotification(), var1);

      for (EntityEventType var5 : EntityEventType.VALUES) {
         this.entityMapsByEventType
            .put(
               var5,
               new EventTypeRegistration<>(
                  var5,
                  (var0, var1x) -> TagSetPlugin.get(NPCGroup.class).tagInSet(var0, var1x),
                  (var0, var1x, var2, var3, var4) -> BlackboardSubscription.notifyEntityEvent(var1x, var2, var3, var4)
               )
            );
      }
   }

   class="kw">public EntityEventView getUpdatedView(@Nonnull Ref<EntityStore> var1, @Nonnull ComponentAccessor<EntityStore> var2) {
      World var3 = var2.getExternalData().getWorld();
      if (!var3.equals(this.world)) {
         Blackboard var4 = var2.getResource(Blackboard.getResourceType());
         class="kw">return var4.getView(EntityEventView.class, var1, var2);
      } else {
         class="kw">return this;
      }
   }

   @Override
   class="kw">public void initialiseEntity(@Nonnull Ref<EntityStore> var1, @Nonnull BlackboardSubscription var2) {
      for (EntityEventType var6 : EntityEventType.VALUES) {
         IntSet var7 = var2.getEntityEventSet(var6);
         if (var7 != null) {
            this.entityMapsByEventType.get(var6).initialiseEntity(var1, var7);
         }
      }
   }

   class="kw">protected void onEvent(
      int var1,
      double var2,
      double var4,
      double var6,
      Ref<EntityStore> var8,
      @Nonnull Ref<EntityStore> var9,
      @Nonnull ComponentAccessor<EntityStore> var10,
      EntityEventType var11
   ) {
      FlockMembership var12 = var10.getComponent(var9, FlockMembership.getComponentType());
      Ref var13 = var12 != null ? var12.getFlockRef() : null;
      this.reusableEventNotification.setFlockReference(var13);
      super.onEvent(var1, var2, var4, var6, var8, var9, var10, var11);
   }

   class="kw">public void onEntityUseEntity(@Nonnull Ref<EntityStore> var1, @Nonnull UseEntityEvent.Post var2) {
      if (var2.getInteractionType() == InteractionType.Use) {
         Store var3 = var1.getStore();
         if (EntityDetectionUtil.isDetectableByNPCs(var1, var3)) {
            Ref var4 = var2.getTargetEntity();
            if (var4.isValid()) {
               NPCEntity var5 = var3.getComponent(var4, NPCEntity.getComponentType());
               if (var5 != null) {
                  TransformComponent var6 = var3.getComponent(var4, TransformComponent.getComponentType());
                  assert var6 != null;
                  Vector3d var7 = var6.getPosition();
                  this.onEvent(var5.getRoleIndex(), var7.x, var7.y, var7.z, var1, var4, var3, EntityEventType.INTERACTION);
               }
            }
         }
      }
   }

   class="kw">public void processAttackedEvent(
      @Nonnull Ref<EntityStore> var1, @Nonnull Ref<EntityStore> var2, @Nonnull ComponentAccessor<EntityStore> var3, @Nonnull EntityEventType var4
   ) {
      int var5;
      if (var3.getArchetype(var1).contains(Player.getComponentType())) {
         var5 = BuilderManager.getPlayerGroupID();
      } else {
         NPCEntity var6 = var3.getComponent(var1, NPCEntity.getComponentType());
         if (var6 == null) {
            class="kw">return;
         }

         var5 = var6.getRoleIndex();
      }

      Store var9 = var1.getStore();
      TransformComponent var7 = var9.getComponent(var1, TransformComponent.getComponentType());
      assert var7 != null;
      Vector3d var8 = var7.getPosition();
      this.onEvent(var5, var8.x, var8.y, var8.z, var2, var2, var3, var4);
   }
}