Class BukkitBrain
java.lang.Object
me.gamercoder215.mobchip.bukkit.BukkitBrain
- All Implemented Interfaces:
EntityBrain
Bukkit Implementation of EntityBrain
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether this Mob can see another Entity.voidClears this Entity's Restriction Area.booleancontainsMemory(@NotNull Memory<?> memory) Whether this Brain contains this memory.@NotNull EntityNavigationCreates new Entity Navigation associated with this Brain.@NotNull AttributeInstancegetAttributeInstance(@NotNull Attribute a) Fetches the MobChip Attribute Instance.Get the Entity's Scheduling Manager associated with this Brain.@NotNull EntityBodygetBody()Fetches the Entity Body Editor.static @Nullable DragonBraingetBrain(@Nullable EnderDragon d) Gets the DragonBrain of this EnderDragon.static @Nullable EntityBrainGet the EntityBrain of this Mob.@NotNull EntityCombatTrackerFetches the Entity's Combat Tracker.@NotNull EntityControllerGet the Entity Controller associated with this Brain.@NotNull MobGet the Entity that this Brain relates to.longgetExpiration(@NotNull Memory<?> memory) Get the expiration date of this Memory.@NotNull EntityAIGet the Entity AI associated with this Brain.<T> TFetch the Memory that is stored in this Entity's Brain.getMemoryStatus(@NotNull Memory<?> memory) Fetches the status of a Memory.static @Nullable Sensor<?> getRegisteredSensor(@NotNull NamespacedKey key) Fetches the Sensor registered with this key.Gets the current restriction area.intFetch the current restriction radius for this entity.@NotNull EntityScheduleManagerGets the EntityScheduleManager associated with this Brain.@NotNull EntitySensesFetches this Entity's Senses.@NotNull EntityAIGet the Entity Target AI associated with this Brain.booleanWhether this entity has a restriction area.booleanWhether this Entity is in its restriction area.static booleanisSensorRegistered(@NotNull Sensor<?> sensor) Checks whether this sensor is registered.static booleanisSensorRegistered(@NotNull NamespacedKey key) Checks whether a sensor is registered with this key.static voidregisterSensor(@NotNull Sensor<?> sensor) Registers a Sensor.voidremoveMemory(@NotNull Memory<?> memory) Removes a Memory from this EntityBrain.<T> voidSets a permanent memory into this entity's brain.<T> voidSets a temporary memory into this entity's brain.voidsetRestrictionArea(Location center, int radius) Sets the Restriction Area for this Entity.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface EntityBrain
canSee, containsAllMemories, setMemories, setMemories
-
Method Details
-
getBrain
Get the EntityBrain of this Mob.- Parameters:
m- Mob to get- Returns:
- EntityBrain
-
getBrain
Gets the DragonBrain of this EnderDragon.- Parameters:
d- EnderDragon to get- Returns:
- DragonBrain
-
registerSensor
public static void registerSensor(@NotNull @NotNull Sensor<?> sensor) throws IllegalArgumentException Registers a Sensor.- Parameters:
sensor- Sensor to Register- Throws:
IllegalArgumentException- if sensor is already registered with this key
-
isSensorRegistered
Checks whether this sensor is registered.- Parameters:
sensor- Sensor to check- Returns:
- true if registered, false otherwise
-
isSensorRegistered
Checks whether a sensor is registered with this key.- Parameters:
key- NamespacedKey of the Sensor- Returns:
- true if registered, false otherwise
-
getRegisteredSensor
@Nullable public static @Nullable Sensor<?> getRegisteredSensor(@NotNull @NotNull NamespacedKey key) Fetches the Sensor registered with this key.- Parameters:
key- NamespacedKey of the Sensor- Returns:
- Sensor Registered, or null if not found
-
getGoalAI
Get the Entity AI associated with this Brain.- Specified by:
getGoalAIin interfaceEntityBrain- Returns:
- Entity AI
-
getAttributeInstance
Fetches the MobChip Attribute Instance.- Specified by:
getAttributeInstancein interfaceEntityBrain- Parameters:
a- Attribute to use- Returns:
- AttributeInstance
-
getTargetAI
Get the Entity Target AI associated with this Brain.- Specified by:
getTargetAIin interfaceEntityBrain- Returns:
- Entity Target AI
-
getController
Get the Entity Controller associated with this Brain.- Specified by:
getControllerin interfaceEntityBrain- Returns:
- Entity Controller
-
getScheduleManager
Gets the EntityScheduleManager associated with this Brain.- Specified by:
getScheduleManagerin interfaceEntityBrain- Returns:
- EntityScheduleManager
-
getBehaviors
Get the Entity's Scheduling Manager associated with this Brain.- Specified by:
getBehaviorsin interfaceEntityBrain- Returns:
- Schedule Manager
-
getBody
Fetches the Entity Body Editor.- Specified by:
getBodyin interfaceEntityBrain- Returns:
- Entity Body Editor
-
getCombatTracker
Description copied from interface:EntityBrainFetches the Entity's Combat Tracker.- Specified by:
getCombatTrackerin interfaceEntityBrain- Returns:
- Entity Combat Tracker
-
getSenses
Description copied from interface:EntityBrainFetches this Entity's Senses.- Specified by:
getSensesin interfaceEntityBrain- Returns:
- Entity Senses
-
setMemory
public <T> void setMemory(@NotNull @NotNull Memory<T> memory, @Nullable T value) throws IllegalArgumentException Sets a permanent memory into this entity's brain.- Specified by:
setMemoryin interfaceEntityBrain- Type Parameters:
T- Memory Type- Parameters:
memory- Memory to changevalue- Value of new memory, null to remove- Throws:
IllegalArgumentException- if the value is not suitable for this memory
-
setMemory
public <T> void setMemory(@NotNull @NotNull Memory<T> memory, @Nullable T value, long expire) throws IllegalArgumentException Sets a temporary memory into this entity's brain.Removing ANY memory should be using
setMemory(Memory, Object)with null as the second parameter.- Specified by:
setMemoryin interfaceEntityBrain- Type Parameters:
T- Memory Type- Parameters:
memory- Memory to changevalue- Value of new memoryexpire- 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
-
getMemory
Fetch the Memory that is stored in this Entity's Brain.- Specified by:
getMemoryin interfaceEntityBrain- Type Parameters:
T- Memory Type- Parameters:
memory- Memory to fetch- Returns:
- Found value as an object, null if not present
-
getExpiration
Get the expiration date of this Memory.- Specified by:
getExpirationin interfaceEntityBrain- Parameters:
memory- Memory to fetch- Returns:
- Found expiration date, or 0 if no expiration or not found
-
containsMemory
Whether this Brain contains this memory.- Specified by:
containsMemoryin interfaceEntityBrain- Parameters:
memory- Memory to fetch- Returns:
- true if contains, else false
-
removeMemory
Description copied from interface:EntityBrainRemoves a Memory from this EntityBrain.- Specified by:
removeMemoryin interfaceEntityBrain- Parameters:
memory- Memory to remove
-
getMemoryStatus
Description copied from interface:EntityBrainFetches the status of a Memory.- Specified by:
getMemoryStatusin interfaceEntityBrain- Parameters:
memory- Memory to fetch- Returns:
- Memory Status inside the brain.
-
isInRestriction
public boolean isInRestriction()Whether this Entity is in its restriction area.- Specified by:
isInRestrictionin interfaceEntityBrain- Returns:
- true if inside, else false
-
setRestrictionArea
Sets the Restriction Area for this Entity.- Specified by:
setRestrictionAreain interfaceEntityBrain- Parameters:
center- Location centerradius- Radius of restriction center
-
clearRestrictionArea
public void clearRestrictionArea()Clears this Entity's Restriction Area.- Specified by:
clearRestrictionAreain interfaceEntityBrain
-
getRestrictionArea
Gets the current restriction area.- Specified by:
getRestrictionAreain interfaceEntityBrain- Returns:
- Restriction Area
-
hasRestriction
public boolean hasRestriction()Whether this entity has a restriction area.- Specified by:
hasRestrictionin interfaceEntityBrain- Returns:
- true if it has a restriction area, else false
-
getRestrictionRadius
public int getRestrictionRadius()Fetch the current restriction radius for this entity.- Specified by:
getRestrictionRadiusin interfaceEntityBrain- Returns:
- Restriction Radius
-
canSee
Whether this Mob can see another Entity.- Specified by:
canSeein interfaceEntityBrain- Parameters:
en- Entity to test- Returns:
- true if entity can see, else false
-
getEntity
Get the Entity that this Brain relates to.- Specified by:
getEntityin interfaceEntityBrain- Returns:
- Entity of this brain
-