Interface EntityBrain

All Known Subinterfaces:
DragonBrain, VillagerBrain
All Known Implementing Classes:
BukkitBrain

public interface EntityBrain
Represents an Entire Entity Brain
  • Method Details

    • getEntity

      @NotNull @NotNull Mob getEntity()
      Get the Entity that this Brain relates to.
      Returns:
      Entity of this brain
    • getGoalAI

      Get the Entity AI associated with this Brain.
      Returns:
      Entity AI
    • getAttributeInstance

      Fetches a MobChip Attribute Instance.
      Parameters:
      a - Attribute to use
      Returns:
      AttributeInstance
    • getTargetAI

      @NotNull @NotNull EntityAI getTargetAI()
      Get the Entity Target AI associated with this Brain.
      Returns:
      Entity Target AI
    • createNavigation

      @NotNull @NotNull EntityNavigation createNavigation()
      Creates new Entity Navigation associated with this Brain.
      Returns:
      Created Entity Navigation
    • getController

      Get the Entity Controller associated with this Brain.
      Returns:
      Entity Controller
    • getScheduleManager

      Get the Entity's Scheduling Manager associated with this Brain.
      Returns:
      Schedule Manager
    • getBehaviors

      EntityBehavior getBehaviors()
      Get the Entity's Behavior associated with this Brain.
      Returns:
      Entity Behavior
    • setMemory

      <T> void setMemory(@NotNull @NotNull Memory<T> memory, @Nullable T value) throws IllegalArgumentException
      Sets a permanent memory into this entity's brain.
      Type Parameters:
      T - Memory Type
      Parameters:
      memory - Memory to change
      value - Value of new memory, null to remove
      Throws:
      IllegalArgumentException - if the value is not suitable for this memory
    • setMemory

      <T> void setMemory(@NotNull @NotNull Memory<T> memory, @Nullable T value, long expire) throws IllegalArgumentException
      Sets a temporary memory into this entity's brain.
      Type Parameters:
      T - Memory Type
      Parameters:
      memory - Memory to change
      value - Value of new memory
      expire - How many ticks until this memory will be forgotten/removed
      Throws:
      IllegalArgumentException - if the value is not suitable for this memory / ticks amount is invalid
    • setMemories

      default void setMemories(@NotNull @NotNull Map<Memory,?> map)
      Sets multiple permanent memories into this Entity's Brain.
      Parameters:
      map - Map of Memories to their values
    • setMemories

      default void setMemories(@NotNull @NotNull Map<Memory,?> map, long expire)
      Sets multiple temporary memories into this Entity's Brain.
      Parameters:
      map - Map of Memories to their values
      expire - How many ticks until this memory is forgotten/removed
    • getMemory

      @Nullable <T> T getMemory(@NotNull @NotNull Memory<T> memory)
      Fetch the Memory that is stored in this Entity's Brain.
      Type Parameters:
      T - Memory Type
      Parameters:
      memory - Memory to fetch
      Returns:
      Found value as an object, null if not present
    • getExpiration

      long getExpiration(@NotNull @NotNull Memory<?> memory)

      Get the expiration date of this Memory.

      For memories with a Unit type, this value should be read instead of using getMemory(Memory).

      Parameters:
      memory - Memory to fetch
      Returns:
      Found expiration date, or 0 if no expiration or not found
    • containsMemory

      boolean containsMemory(@NotNull @NotNull Memory<?> memory)
      Whether this Brain contains this memory.
      Parameters:
      memory - Memory to fetch
      Returns:
      true if contains, else false
    • removeMemory

      void removeMemory(@NotNull @NotNull Memory<?> memory)
      Removes a Memory from this EntityBrain.
      Parameters:
      memory - Memory to remove
    • getMemoryStatus

      MemoryStatus getMemoryStatus(@NotNull @NotNull Memory<?> memory)
      Fetches the status of a Memory.
      Parameters:
      memory - Memory to fetch
      Returns:
      Memory Status inside the brain.
    • containsAllMemories

      default boolean containsAllMemories(@NotNull @NotNull Memory<?>... memories)
      Whether this Brain contains all of these memories.
      Parameters:
      memories - Group of memories to query
      Returns:
      true if they all are contained, else false
    • isInRestriction

      boolean isInRestriction()
      Whether this Entity is in its restriction area.
      Returns:
      true if inside, else false
    • setRestrictionArea

      void setRestrictionArea(Location center, int radius)
      Sets the Restriction Area for this Entity.
      Parameters:
      center - Location center
      radius - Radius of restriction center
    • clearRestrictionArea

      void clearRestrictionArea()
      Clears this Entity's Restriction Area.
    • getRestrictionArea

      Location getRestrictionArea()
      Gets the current restriction area.
      Returns:
      Restriction Area
    • hasRestriction

      boolean hasRestriction()
      Whether this entity has a restriction area.
      Returns:
      true if it has a restriction area, else false
    • getRestrictionRadius

      int getRestrictionRadius()
      Fetch the current restriction radius for this entity.
      Returns:
      Restriction Radius
    • canSee

      boolean canSee(@Nullable @Nullable Entity en)
      Whether this Mob can see another Entity.
      Parameters:
      en - Entity to test
      Returns:
      true if entity can see, else false
    • canSee

      default boolean canSee(@Nullable @Nullable EntityBrain brain)
      Whether this Mob can see another Entity.
      Parameters:
      brain - EntityBrain to test
      Returns:
      true if entity can see, else false
    • getBody

      Fetches the Entity Body Editor.
      Returns:
      Entity Body Editor
    • getCombatTracker

      Fetches the Entity's Combat Tracker.
      Returns:
      Entity Combat Tracker
    • getSenses

      Fetches this Entity's Senses.
      Returns:
      Entity Senses