Skip to content

🤖 Behavior Profiles, Goal Flags & State Accessors ​

Overview of the Goal Priority Matrix, BatStateAccessor interface, and flag management controlling bat state transitions.


📊 AI Goal Priority Matrix ​

All goals set move flags (this.setFlags(EnumSet.of(Goal.Flag.MOVE))) to prevent movement conflicts:

Priority LevelGoal ClassActivation ConditionBehavior Summary
Priority 1BatPanicGoalVibration / Explosion event received (panicTicks > 0)Disperses from group, flies rapidly in opposite vector of noise source for 5 seconds ($100\text{ ticks}$).
Priority 2BatSleepGoalDaytime bright outside OR raining exposed to skySearches 16-block radius for dark roost surface (Sky=0, Block<=7), prioritizing resting bat clusters.
Priority 4BatHuntLightGoalNighttime, Block Light > 8 detected within 10 blocksApproaches with curved banking, orbits light center for 10–30s with vertical sine bobbing and CRIT particles.
Priority 5BatDiveBombGoalbat_pest_control == true, Silverfish/Endermite within 8 blocksDives towards pest at $0.3\text{ b/t}$, dealing $10.0 \times \text{attack_damage_trait}$ damage upon impact.

🕹️ BatStateAccessor Interface Protocol ​

BatStateAccessor provides lightweight duck-typing access to internal state flags on vanilla Bat entities without polluting vanilla entity classes:

java
public interface BatStateAccessor {
    boolean betterbats$isGoalActive();
    void betterbats$setGoalActive(boolean active);
    void betterbats$resetGuanoTicks();
    void betterbats$panic(Vec3 source);
    boolean betterbats$isPanicked();
    int betterbats$getPanicTicks();
    void betterbats$setPanicTicks(int ticks);
    Vec3 betterbats$getPanicSource();
}
  • When betterbats$isGoalActive() returns true, ambient BatFlightHelper BOIDs flocking and organic wandering are temporarily suspended, allowing the active custom goal full control over the entity's delta movement.

Official documentation & web portal for Dasik Igaijinn mods.