VoidEventStagesSystem class

Пакет: com.hypixel.hytale.builtin.portals.systems.voidevent

Файл: com/hypixel/hytale/builtin/portals/systems/voidevent/VoidEventStagesSystem.java

extends: DelayedEntitySystem<EntityStore>

Поля (17)

МодификаторыТипИмя
VoidEventConfig var10
double var11
int var13
int var14
int var15
VoidEventStage var16
VoidEventStage var17
List var2
String var3
String var3
VoidEventStage var4
WeatherResource var4
WeatherResource var4
PortalWorld var6
Ref var7
VoidEvent var8
World var9

Методы (12)

МодификаторыВозвратСигнатура
if if(var8 != null)
if if(var10 != null)
if if(var16 != var17)
if if(var16 != null)
if if(var17 != null)
if if(var3 != null)
if if(var3 != null)
static void startStagevoid startStage(@Nonnull VoidEventStage var0, @Nonnull Store<EntityStore> var1, @Nonnull CommandBuffer<EntityStore> var2)
abstract startStage startStage(var17, var4, var5)
static void stopStagevoid stopStage(@Nonnull VoidEventStage var0, @Nonnull Store<EntityStore> var1, @Nonnull CommandBuffer<EntityStore> var2)
abstract stopStage stopStage(var16, var4, var5)
abstract super super(1.5F)

Исходный код

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

class="kw">import com.hypixel.hytale.builtin.portals.components.voidevent.VoidEvent;
class="kw">import com.hypixel.hytale.builtin.portals.components.voidevent.config.VoidEventConfig;
class="kw">import com.hypixel.hytale.builtin.portals.components.voidevent.config.VoidEventStage;
class="kw">import com.hypixel.hytale.builtin.portals.resources.PortalWorld;
class="kw">import com.hypixel.hytale.builtin.weather.resources.WeatherResource;
class="kw">import com.hypixel.hytale.component.ArchetypeChunk;
class="kw">import com.hypixel.hytale.component.CommandBuffer;
class="kw">import com.hypixel.hytale.component.Ref;
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.tick.DelayedEntitySystem;
class="kw">import com.hypixel.hytale.logger.HytaleLogger;
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 java.util.List;
class="kw">import java.util.logging.Level;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;

class="kw">public class VoidEventStagesSystem class="kw">extends DelayedEntitySystem<EntityStore> {
   class="kw">public VoidEventStagesSystem() {
      super(1.5F);
   }

   @Override
   class="kw">public void tick(float var1, int var2, @Nonnull ArchetypeChunk<EntityStore> var3, @Nonnull Store<EntityStore> var4, @Nonnull CommandBuffer<EntityStore> var5) {
      PortalWorld var6 = var4.getResource(PortalWorld.getResourceType());
      if (var6.exists()) {
         Ref var7 = var6.getVoidEventRef();
         VoidEvent var8 = var7 == null ? null : var5.getComponent(var7, VoidEvent.getComponentType());
         if (var8 != null) {
            World var9 = var4.getExternalData().getWorld();
            VoidEventConfig var10 = var6.getVoidEventConfig();
            if (var10 != null) {
               double var11 = var6.getElapsedSeconds(var9);
               int var13 = var6.getTimeLimitSeconds();
               int var14 = var10.getShouldStartAfterSeconds(var13);
               int var15 = (int)Math.max(0.0, var11 - var14);
               VoidEventStage var16 = var8.getActiveStage();
               VoidEventStage var17 = computeAppropriateStage(var10, var15);
               if (var16 != var17) {
                  if (var16 != null) {
                     stopStage(var16, var4, var5);
                  }

                  if (var17 != null) {
                     startStage(var17, var4, var5);
                  }

                  var8.setActiveStage(var17);
               }
            }
         }
      }
   }

   @Nullable
   class="kw">private class="kw">static VoidEventStage computeAppropriateStage(@Nonnull VoidEventConfig var0, int var1) {
      List var2 = var0.getStagesSortedByStartTime();

      for (int var3 = var2.size() - 1; var3 >= 0; var3--) {
         VoidEventStage var4 = var2.get(var3);
         if (var1 > var4.getSecondsInto()) {
            class="kw">return var4;
         }
      }

      class="kw">return null;
   }

   class="kw">public class="kw">static void startStage(@Nonnull VoidEventStage var0, @Nonnull Store<EntityStore> var1, @Nonnull CommandBuffer<EntityStore> var2) {
      HytaleLogger.getLogger().at(Level.INFO).log("Starting stage SecondsInto=%d in portal void event", var0.getSecondsInto());
      String var3 = var0.getForcedWeatherId();
      if (var3 != null) {
         WeatherResource var4 = var1.getResource(WeatherResource.getResourceType());
         var4.setForcedWeather(var3);
      }
   }

   class="kw">public class="kw">static void stopStage(@Nonnull VoidEventStage var0, @Nonnull Store<EntityStore> var1, @Nonnull CommandBuffer<EntityStore> var2) {
      HytaleLogger.getLogger().at(Level.INFO).log("Stopping stage SecondsInto=%d in portal void event", var0.getSecondsInto());
      String var3 = var0.getForcedWeatherId();
      if (var3 != null) {
         WeatherResource var4 = var1.getResource(WeatherResource.getResourceType());
         var4.setForcedWeather(null);
      }
   }

   @Nullable
   @Override
   class="kw">public Query<EntityStore> getQuery() {
      class="kw">return VoidEvent.getComponentType();
   }
}