44 lines
1.1 KiB
Java
44 lines
1.1 KiB
Java
package com.thebrokenrail.herobrine.entity.ai;
|
|
|
|
import com.thebrokenrail.herobrine.entity.HerobrineEntity;
|
|
import net.minecraft.nbt.CompoundTag;
|
|
|
|
public abstract class AIStage {
|
|
private String id;
|
|
private final HerobrineEntity entity;
|
|
|
|
public AIStage(HerobrineEntity entity) {
|
|
this.entity = entity;
|
|
}
|
|
|
|
public final String getID() {
|
|
return id;
|
|
}
|
|
final void setID(String id) {
|
|
this.id = id;
|
|
}
|
|
|
|
protected HerobrineEntity getEntity() {
|
|
return entity;
|
|
}
|
|
|
|
public final void nextStage() {
|
|
entity.getAI().nextStage();
|
|
}
|
|
|
|
public abstract void tick();
|
|
public abstract void fromTag(CompoundTag tag);
|
|
public abstract CompoundTag toTag();
|
|
|
|
public static abstract class AIStageFactory<T extends AIStage> {
|
|
public abstract boolean canStart(HerobrineEntity entity);
|
|
protected abstract T createInternal(HerobrineEntity entity);
|
|
public T create(HerobrineEntity entity) {
|
|
T obj = createInternal(entity);
|
|
obj.setID(getID());
|
|
return obj;
|
|
}
|
|
public abstract String getID();
|
|
}
|
|
}
|