SensorWeather class
Пакет: com.hypixel.hytale.server.npc.corecomponents.world
Файл: com/hypixel/hytale/server/npc/corecomponents/world/SensorWeather.java
extends: SensorBase
Поля (2)
| Модификаторы | Тип | Имя |
|---|---|---|
|
int |
var6 |
|
String |
var7 |
Методы (6)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
|
for for(String var5 : this.weathers) |
|
|
if if(var6 == 0) |
|
|
if if(var6 == this.prevWeatherIndex) |
|
|
if if(var1 == null) |
protected |
boolean |
matchesWeatherboolean matchesWeather(@Nullable String var1) |
abstract |
|
super super(var1) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.npc.corecomponents.world;
class="kw">import com.hypixel.hytale.common.util.StringUtil;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.server.core.asset.type.weather.config.Weather;
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.world.builders.BuilderSensorWeather;
class="kw">import com.hypixel.hytale.server.npc.instructions.ExecutionSupport;
class="kw">import com.hypixel.hytale.server.npc.sensorinfo.InfoProvider;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">public class SensorWeather class="kw">extends SensorBase {
@Nullable
class="kw">protected class="kw">final String[] weathers;
class="kw">protected int prevWeatherIndex;
class="kw">protected boolean cachedResult;
class="kw">public SensorWeather(@Nonnull BuilderSensorWeather var1, @Nonnull BuilderSupport var2) {
super(var1);
this.weathers = var1.getWeathers(var2);
}
@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;
}
int var6 = var2.getWorldSupport().getCurrentWeatherIndex(var1, var5);
if (var6 == 0) {
class="kw">return false;
}
if (var6 == this.prevWeatherIndex) {
class="kw">return this.cachedResult;
}
String var7 = Weather.getAssetMap().getAsset(var6).getId();
this.prevWeatherIndex = var6;
this.cachedResult = this.matchesWeather(var7);
class="kw">return this.cachedResult;
}
@Override
class="kw">public InfoProvider getSensorInfo() {
class="kw">return null;
}
class="kw">protected boolean matchesWeather(@Nullable String var1) {
if (var1 == null) {
class="kw">return false;
}
for (String var5 : this.weathers) {
if (StringUtil.isGlobMatching(var5, var1)) {
class="kw">return true;
}
}
class="kw">return false;
}
}