SensorTimer class

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

Файл: com/hypixel/hytale/server/npc/corecomponents/timer/SensorTimer.java

extends: SensorBase

Поля (2)

МодификаторыТипИмя
final double minTimeRemaining
double[] var3

Методы (2)

МодификаторыВозвратСигнатура
protected boolean isBetweenboolean isBetween(double var1)
abstract super super(var1)

Исходный код

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

class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import com.hypixel.hytale.server.npc.asset.builder.BuilderSupport;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.SensorBase;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.timer.builders.BuilderSensorTimer;
class="kw">import com.hypixel.hytale.server.npc.instructions.ExecutionSupport;
class="kw">import com.hypixel.hytale.server.npc.sensorinfo.InfoProvider;
class="kw">import com.hypixel.hytale.server.npc.util.Timer;
class="kw">import javax.annotation.Nonnull;

class="kw">public class SensorTimer class="kw">extends SensorBase {
   class="kw">protected class="kw">final double minTimeRemaining;
   class="kw">protected class="kw">final double maxTimeRemaining;
   class="kw">protected class="kw">final Timer timer;
   class="kw">protected class="kw">final Timer.TimerState timerState;

   class="kw">public SensorTimer(@Nonnull BuilderSensorTimer var1, @Nonnull BuilderSupport var2) {
      super(var1);
      this.timer = var1.getTimer(var2);
      double[] var3 = var1.getRemainingTimeRange(var2);
      this.minTimeRemaining = var3[0];
      this.maxTimeRemaining = var3[1];
      this.timerState = var1.getTimerState();
   }

   @Override
   class="kw">public boolean matches(@Nonnull Ref<EntityStore> var1, @Nonnull ExecutionSupport var2, double var3, @Nonnull Store<EntityStore> var5) {
      if (!super.matches(var1, var2, var3, var5)) {
         class="kw">return false;
      } else {
         class="kw">return !this.timer.isInitialised()
            ? (this.timerState == Timer.TimerState.ANY || this.timerState == Timer.TimerState.STOPPED) && this.isBetween(0.0)
            : this.timer.isInState(this.timerState) && this.isBetween(this.timer.getValue());
      }
   }

   @Override
   class="kw">public InfoProvider getSensorInfo() {
      class="kw">return null;
   }

   class="kw">protected boolean isBetween(double var1) {
      class="kw">return var1 >= this.minTimeRemaining && var1 <= this.maxTimeRemaining;
   }
}