Setup class

Пакет: com.hypixel.hytale.server.core.modules.entity.dynamiclight

Файл: com/hypixel/hytale/server/core/modules/entity/dynamiclight/DynamicLightSystems.java

extends: HolderSystem<EntityStore>

Поля (4)

МодификаторыТипИмя
private final ComponentType<EntityStore, DynamicLight> dynamicLightComponentType
private final ComponentType<EntityStore, PersistentDynamicLight> persistentDynamicLightComponentType
private final Query<EntityStore> query
PersistentDynamicLight var4

Методы (3)

МодификаторыВозвратСигнатура
public Query<EntityStore> getQuerypublic Query<EntityStore> getQuery()
public void onEntityAddpublic void onEntityAdd(@Nonnull Holder<EntityStore> var1, @Nonnull AddReason var2, @Nonnull Store<EntityStore> var3)
public void onEntityRemovedpublic void onEntityRemoved(@Nonnull Holder<EntityStore> var1, @Nonnull RemoveReason var2, @Nonnull Store<EntityStore> var3)

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.modules.entity.dynamiclight;

class="kw">import com.hypixel.hytale.component.AddReason;
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.RefChangeSystem;
class="kw">import com.hypixel.hytale.protocol.ComponentUpdateType;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.DynamicLight;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.PersistentDynamicLight;
class="kw">import com.hypixel.hytale.server.core.modules.entity.tracker.EntityTrackerSystems;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import javax.annotation.Nonnull;

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

   class="kw">public class="kw">static class EntityTrackerRemove class="kw">extends RefChangeSystem<EntityStore, DynamicLight> {
      class="kw">private class="kw">final ComponentType<EntityStore, EntityTrackerSystems.Visible> visibleComponentType;

      class="kw">public EntityTrackerRemove(ComponentType<EntityStore, EntityTrackerSystems.Visible> var1) {
         this.visibleComponentType = var1;
      }

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

      @Nonnull
      @Override
      class="kw">public ComponentType<EntityStore, DynamicLight> componentType() {
         class="kw">return DynamicLight.getComponentType();
      }

      class="kw">public void onComponentAdded(
         @Nonnull Ref<EntityStore> var1, @Nonnull DynamicLight var2, @Nonnull Store<EntityStore> var3, @Nonnull CommandBuffer<EntityStore> var4
      ) {
      }

      class="kw">public void onComponentSet(
         @Nonnull Ref<EntityStore> var1,
         DynamicLight var2,
         @Nonnull DynamicLight var3,
         @Nonnull Store<EntityStore> var4,
         @Nonnull CommandBuffer<EntityStore> var5
      ) {
      }

      class="kw">public void onComponentRemoved(
         @Nonnull Ref<EntityStore> var1, @Nonnull DynamicLight var2, @Nonnull Store<EntityStore> var3, @Nonnull CommandBuffer<EntityStore> var4
      ) {
         EntityTrackerSystems.Visible var5 = var4.getComponent(var1, this.visibleComponentType);
         if (var5 != null) {
            for (EntityTrackerSystems.EntityViewer var7 : var5.visibleTo.values()) {
               var7.queueRemove(var1, ComponentUpdateType.DynamicLight);
            }
         }
      }
   }

   class="kw">public class="kw">static class Setup class="kw">extends HolderSystem<EntityStore> {
      class="kw">private class="kw">final ComponentType<EntityStore, DynamicLight> dynamicLightComponentType = DynamicLight.getComponentType();
      class="kw">private class="kw">final ComponentType<EntityStore, PersistentDynamicLight> persistentDynamicLightComponentType = PersistentDynamicLight.getComponentType();
      class="kw">private class="kw">final Query<EntityStore> query = Query.and(this.persistentDynamicLightComponentType, Query.not(this.dynamicLightComponentType));

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

      @Override
      class="kw">public void onEntityAdd(@Nonnull Holder<EntityStore> var1, @Nonnull AddReason var2, @Nonnull Store<EntityStore> var3) {
         PersistentDynamicLight var4 = var1.getComponent(this.persistentDynamicLightComponentType);
         var1.putComponent(this.dynamicLightComponentType, new DynamicLight(var4.getColorLight()));
      }

      @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;
      }
   }
}