Files
CustomNPC-Plus/src/main/java/noppes/npcs/ai/EntityAIWorldLines.java
T

30 lines
783 B
Java
Raw Normal View History

2018-09-13 12:03:28 -04:00
package noppes.npcs.ai;
import net.minecraft.entity.ai.EntityAIBase;
import noppes.npcs.constants.AiMutex;
import noppes.npcs.entity.EntityNPCInterface;
public class EntityAIWorldLines extends EntityAIBase {
2025-03-12 20:12:01 -04:00
private final EntityNPCInterface npc;
2024-03-12 01:54:44 -04:00
private int cooldown = 100;
2025-03-12 20:12:01 -04:00
public EntityAIWorldLines(EntityNPCInterface npc) {
2024-03-12 01:54:44 -04:00
this.npc = npc;
2018-09-13 12:03:28 -04:00
this.setMutexBits(AiMutex.PASSIVE);
}
2024-03-12 01:54:44 -04:00
@Override
public boolean shouldExecute() {
2025-03-12 20:12:01 -04:00
if (cooldown > 0) {
2024-03-12 01:54:44 -04:00
cooldown--;
}
return !npc.isAttacking() && !npc.isKilled() && npc.advanced.hasWorldLines() && npc.getRNG().nextInt(1800) == 1;
}
2025-03-12 20:12:01 -04:00
public void startExecuting() {
2024-03-12 01:54:44 -04:00
cooldown = 100;
npc.saySurrounding(npc.advanced.getWorldLine());
}
2018-09-13 12:03:28 -04:00
}