Package me.gamercoder215.mobchip.bukkit
Class BukkitBrain
java.lang.Object
me.gamercoder215.mobchip.bukkit.BukkitBrain
- All Implemented Interfaces:
EntityBrain
Bukkit Implementation of EntityBrain
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Whether this Mob can see another Entity.void
Clears this Entity's Restriction Area.boolean
containsMemory
(@NotNull Memory<?> memory) Whether this Brain contains this memory.Creates new Entity Navigation associated with this Brain.Fetches the MobChip Attribute Instance.Get the Entity's Scheduling Manager associated with this Brain.getBody()
Fetches the Entity Body Editor.static @Nullable DragonBrain
Gets the DragonBrain of this EnderDragon.static @Nullable EntityBrain
Get the EntityBrain of this Mob.Fetches the Entity's Combat Tracker.Get the Entity Controller associated with this Brain.Get the Entity that this Brain relates to.long
getExpiration
(@NotNull Memory<?> memory) Get the expiration date of this Memory.Get the Entity AI associated with this Brain.<T> T
Fetch the Memory that is stored in this Entity's Brain.getMemoryStatus
(@NotNull Memory<?> memory) Fetches the status of a Memory.Fetches the Sensor registered with this key.Gets the current restriction area.int
Fetch the current restriction radius for this entity.Gets the EntityScheduleManager associated with this Brain.Fetches this Entity's Senses.Get the Entity Target AI associated with this Brain.boolean
Whether this entity has a restriction area.boolean
Whether this Entity is in its restriction area.static boolean
isSensorRegistered
(@NotNull Sensor<?> sensor) Checks whether this sensor is registered.static boolean
Checks whether a sensor is registered with this key.static void
registerSensor
(@NotNull Sensor<?> sensor) Registers a Sensor.void
removeMemory
(@NotNull Memory<?> memory) Removes a Memory from this EntityBrain.<T> void
Sets a permanent memory into this entity's brain.<T> void
Sets a temporary memory into this entity's brain.void
setRestrictionArea
(Location center, int radius) Sets the Restriction Area for this Entity.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface me.gamercoder215.mobchip.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:
getGoalAI
in interfaceEntityBrain
- Returns:
- Entity AI
-
getAttributeInstance
Fetches the MobChip Attribute Instance.- Specified by:
getAttributeInstance
in interfaceEntityBrain
- Parameters:
a
- Attribute to use- Returns:
- AttributeInstance
-
getTargetAI
Get the Entity Target AI associated with this Brain.- Specified by:
getTargetAI
in interfaceEntityBrain
- Returns:
- Entity Target AI
-
getController
Get the Entity Controller associated with this Brain.- Specified by:
getController
in interfaceEntityBrain
- Returns:
- Entity Controller
-
getScheduleManager
Gets the EntityScheduleManager associated with this Brain.- Specified by:
getScheduleManager
in interfaceEntityBrain
- Returns:
- EntityScheduleManager
-
getBehaviors
Get the Entity's Scheduling Manager associated with this Brain.- Specified by:
getBehaviors
in interfaceEntityBrain
- Returns:
- Schedule Manager
-
getBody
Fetches the Entity Body Editor.- Specified by:
getBody
in interfaceEntityBrain
- Returns:
- Entity Body Editor
-
getCombatTracker
Description copied from interface:EntityBrain
Fetches the Entity's Combat Tracker.- Specified by:
getCombatTracker
in interfaceEntityBrain
- Returns:
- Entity Combat Tracker
-
getSenses
Description copied from interface:EntityBrain
Fetches this Entity's Senses.- Specified by:
getSenses
in 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:
setMemory
in 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:
setMemory
in 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:
getMemory
in 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:
getExpiration
in 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:
containsMemory
in interfaceEntityBrain
- Parameters:
memory
- Memory to fetch- Returns:
- true if contains, else false
-
removeMemory
Description copied from interface:EntityBrain
Removes a Memory from this EntityBrain.- Specified by:
removeMemory
in interfaceEntityBrain
- Parameters:
memory
- Memory to remove
-
getMemoryStatus
Description copied from interface:EntityBrain
Fetches the status of a Memory.- Specified by:
getMemoryStatus
in 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:
isInRestriction
in interfaceEntityBrain
- Returns:
- true if inside, else false
-
setRestrictionArea
Sets the Restriction Area for this Entity.- Specified by:
setRestrictionArea
in interfaceEntityBrain
- Parameters:
center
- Location centerradius
- Radius of restriction center
-
clearRestrictionArea
public void clearRestrictionArea()Clears this Entity's Restriction Area.- Specified by:
clearRestrictionArea
in interfaceEntityBrain
-
getRestrictionArea
Gets the current restriction area.- Specified by:
getRestrictionArea
in interfaceEntityBrain
- Returns:
- Restriction Area
-
hasRestriction
public boolean hasRestriction()Whether this entity has a restriction area.- Specified by:
hasRestriction
in 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:
getRestrictionRadius
in interfaceEntityBrain
- Returns:
- Restriction Radius
-
canSee
Whether this Mob can see another Entity.- Specified by:
canSee
in 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:
getEntity
in interfaceEntityBrain
- Returns:
- Entity of this brain
-