ActionTimeout class
Пакет: com.hypixel.hytale.server.npc.corecomponents.utility
Файл: com/hypixel/hytale/server/npc/corecomponents/utility/ActionTimeout.java
extends: ActionWithDelay
implements: IAnnotatedComponentCollection
Поля (1)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
boolean |
delayAfter |
Методы (12)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
abstract |
throw new |
IndexOutOfBoundsExceptionthrow new IndexOutOfBoundsException() |
|
|
if if(this.action != null) |
|
|
if if(this.action != null) |
|
|
if if(this.delayAfter) |
|
|
if if(this.action != null) |
|
|
if if(this.action != null) |
|
|
if if(this.action != null) |
|
|
if if(this.action != null) |
|
|
if if(this.action != null) |
|
|
if if(this.action != null) |
|
|
if if(this.delayAfter) |
abstract |
|
super super(var1, var2) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.npc.corecomponents.utility;
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.server.core.universe.world.World;
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.ActionWithDelay;
class="kw">import com.hypixel.hytale.server.npc.corecomponents.utility.builders.BuilderActionTimeout;
class="kw">import com.hypixel.hytale.server.npc.entities.NPCEntity;
class="kw">import com.hypixel.hytale.server.npc.instructions.Action;
class="kw">import com.hypixel.hytale.server.npc.instructions.ExecutionSupport;
class="kw">import com.hypixel.hytale.server.npc.movement.controllers.MotionController;
class="kw">import com.hypixel.hytale.server.npc.sensorinfo.InfoProvider;
class="kw">import com.hypixel.hytale.server.npc.util.IAnnotatedComponent;
class="kw">import com.hypixel.hytale.server.npc.util.IAnnotatedComponentCollection;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">public class ActionTimeout class="kw">extends ActionWithDelay class="kw">implements IAnnotatedComponentCollection {
class="kw">protected class="kw">final boolean delayAfter;
@Nullable
class="kw">protected class="kw">final Action action;
class="kw">public ActionTimeout(@Nonnull BuilderActionTimeout var1, @Nonnull BuilderSupport var2) {
super(var1, var2);
this.action = var1.getAction(var2);
this.delayAfter = var1.isDelayAfter();
}
@Override
class="kw">public boolean canExecute(
@Nonnull Ref<EntityStore> var1, @Nonnull ExecutionSupport var2, @Nullable InfoProvider var3, double var4, @Nonnull Store<EntityStore> var6
) {
if (super.canExecute(var1, var2, var3, var4, var6) && (this.action == null || this.action.canExecute(var1, var2, var3, var4, var6))) {
if (!this.isDelaying() && this.isDelayPrepared()) {
this.startDelay(var2.getEntitySupport());
}
class="kw">return !this.isDelaying();
} else {
class="kw">return false;
}
}
@Override
class="kw">public boolean execute(
@Nonnull Ref<EntityStore> var1, @Nonnull ExecutionSupport var2, @Nullable InfoProvider var3, double var4, @Nonnull Store<EntityStore> var6
) {
super.execute(var1, var2, var3, var4, var6);
if (this.action != null) {
this.action.execute(var1, var2, var3, var4, var6);
}
this.prepareDelay();
class="kw">return true;
}
@Override
class="kw">public void registerWithSupport(ExecutionSupport var1) {
if (this.action != null) {
this.action.registerWithSupport(var1);
}
if (this.delayAfter) {
this.clearDelay();
} else {
this.prepareDelay();
}
}
@Override
class="kw">public void motionControllerChanged(
@Nullable Ref<EntityStore> var1, @Nonnull NPCEntity var2, MotionController var3, @Nullable ComponentAccessor<EntityStore> var4
) {
if (this.action != null) {
this.action.motionControllerChanged(var1, var2, var3, var4);
}
}
@Override
class="kw">public void loaded(ExecutionSupport var1) {
if (this.action != null) {
this.action.loaded(var1);
}
}
@Override
class="kw">public void spawned(ExecutionSupport var1) {
if (this.action != null) {
this.action.spawned(var1);
}
}
@Override
class="kw">public void unloaded(ExecutionSupport var1) {
if (this.action != null) {
this.action.unloaded(var1);
}
}
@Override
class="kw">public void removed(ExecutionSupport var1) {
if (this.action != null) {
this.action.removed(var1);
}
}
@Override
class="kw">public void teleported(ExecutionSupport var1, World var2, World var3) {
if (this.action != null) {
this.action.teleported(var1, var2, var3);
}
}
@Override
class="kw">public void clearOnce() {
super.clearOnce();
if (this.delayAfter) {
this.clearDelay();
} else {
this.prepareDelay();
}
}
@Override
class="kw">public int componentCount() {
class="kw">return this.action != null ? 1 : 0;
}
@Nullable
@Override
class="kw">public IAnnotatedComponent getComponent(int var1) {
if (var1 >= this.componentCount()) {
throw new IndexOutOfBoundsException();
} else {
class="kw">return this.action;
}
}
}