Interface EntityBehavior
- All Known Subinterfaces:
AllayBehavior, AxolotlBehavior, BreezeBehavior, CamelBehavior, CreatureBehavior, DragonBehavior, FrogBehavior, PiglinBehavior, VillagerBehavior, WardenBehavior
Typically, behaviors require certain Memory objects to be present, not present, or registered in the native Minecraft Registry, and they will default to nothing if they are not present.
Some behaviors will set these memories for you. Those methods will be indicated when necessary.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault @NotNull BehaviorResultbackupIfClose(int minDistance) Makes this Mob back up if it is too close, with no speed modifier.@NotNull BehaviorResultbackupIfClose(int minDistance, float speedModifier) Makes this Mob back up if it is too close.@NotNull BehaviorResultErases a memory if function returns true.@NotNull BehaviorResultMakes this Mob interact with the nearest door.default @NotNull BehaviorResultMakes this Mob jump on a Bed, with no speed Modifier.@NotNull BehaviorResultjumpOnBed(float speedMod) Makes this Mob jump on a Bed.default @NotNull BehaviorResultMakes this Mob perform a Melee Attack, with a cooldown of 3 seconds (60 ticks).@NotNull BehaviorResultmeleeAttack(int cooldown) Makes this Mob perform a Melee Attack.default @NotNull BehaviorResultmoveToWantedItem(int minDist) Makes this Entity move to its wanted item, with no speed modifier.default @NotNull BehaviorResultmoveToWantedItem(int minDist, float speedMod) Makes this Entity move to its wanted item, withrequireTargetset to true.@NotNull BehaviorResultmoveToWantedItem(int minDist, float speedMod, boolean requireTarget) Makes this Entity move to its wanted item.@NotNull BehaviorResultMakes this Entity become Passive is a Memory is present.@NotNull BehaviorResultMakes this Mob react to a Bell ringing, symbolizing an incoming raid.@NotNull BehaviorResultringBell()Makes this Mob ring the nearest bell.@NotNull BehaviorResultsleep()Makes this Mob sleep in a bed.@NotNull BehaviorResultMakes this Mob socialize at the Village's Bell.@NotNull BehaviorResultwakeUp()Wakes up this Mob if it is sleeping.
-
Method Details
-
backupIfClose
Makes this Mob back up if it is too close.This behavior requires
EntityMemory.WALKING_TARGETto be absent,EntityMemory.LOOKING_TARGETto be registered, andEntityMemory.ATTACK_TARGETwithEntityMemory.NEAREST_VISIBLE_LIVING_ENTITIESto be present.- Parameters:
minDistance- Minimum Distance to back upspeedModifier- Speed Modifier while backing up- Returns:
- Result of Behavior
-
backupIfClose
Makes this Mob back up if it is too close, with no speed modifier.This behavior requires
EntityMemory.WALKING_TARGETto be absent,EntityMemory.LOOKING_TARGETto be registered, andEntityMemory.ATTACK_TARGETwithEntityMemory.NEAREST_VISIBLE_LIVING_ENTITIESto be present.- Parameters:
minDistance- Minimum Distance to back up- Returns:
- Result of Behavior
-
passiveIf
@NotNull @NotNull BehaviorResult passiveIf(@NotNull @NotNull Memory<?> memory, int durationTicks) throws IllegalArgumentException Makes this Entity become Passive is a Memory is present.This behavior does not require any other memories to run.
- Parameters:
memory- Memory to usedurationTicks- How long to be passive, in ticks- Returns:
- Result of Behavior
- Throws:
IllegalArgumentException- if memory is null
-
eraseIf
@NotNull @NotNull BehaviorResult eraseIf(@NotNull @NotNull Predicate<Mob> function, @NotNull @NotNull Memory<?> memory) throws IllegalArgumentException Erases a memory if function returns true.This behavior does not require any other memories to run.
- Parameters:
function- Function to test containing Mobmemory- Memory to remove if function returns true- Returns:
- Result of Behavior
- Throws:
IllegalArgumentException- if function or memory is null
-
moveToWantedItem
@NotNull @NotNull BehaviorResult moveToWantedItem(int minDist, float speedMod, boolean requireTarget) Makes this Entity move to its wanted item.This behavior requires
EntityMemory.LOOKING_TARGETandEntityMemory.TICKS_ITEM_PICKUP_COOLDOWNto be registered, andEntityMemory.NEAREST_VISIBLE_WANTED_ITEMto be present.Depending on
requireTarget,EntityMemory.WALKING_TARGETneeds to be present iftrue, or absent iffalse.- Parameters:
minDist- Minimum Distance from ItemspeedMod- Speed Modifier while movingrequireTarget- Whether a walking target is required (if false,EntityMemory.WALKING_TARGETneeds to be absent, defaults to true)- Returns:
- Result of Behavior
-
moveToWantedItem
Makes this Entity move to its wanted item, withrequireTargetset to true.This behavior requires
EntityMemory.LOOKING_TARGETandEntityMemory.TICKS_ITEM_PICKUP_COOLDOWNto be registered, andEntityMemory.NEAREST_VISIBLE_WANTED_ITEMwithEntityMemory.WALKING_TARGETto be present.- Parameters:
minDist- Minimum Distance from ItemspeedMod- Speed Modifier while moving- Returns:
- Result of Behavior
-
moveToWantedItem
Makes this Entity move to its wanted item, with no speed modifier.This behavior requires
EntityMemory.LOOKING_TARGETandEntityMemory.TICKS_ITEM_PICKUP_COOLDOWNto be registered, andEntityMemory.NEAREST_VISIBLE_WANTED_ITEMwithEntityMemory.WALKING_TARGETto be present.- Parameters:
minDist- Minimum Distance from Item- Returns:
- Result of Behavior
-
jumpOnBed
Makes this Mob jump on a Bed.This behavior requires
EntityMemory.NEAREST_BEDto be present, andEntityMemory.WALKING_TARGETto be absent.- Parameters:
speedMod- Speed Modifier while locating a bed- Returns:
- Result of Behavior
-
jumpOnBed
Makes this Mob jump on a Bed, with no speed Modifier.This behavior requires
EntityMemory.NEAREST_BEDto be present, andEntityMemory.WALKING_TARGETto be absent.- Returns:
- Result of Behavior
-
meleeAttack
Makes this Mob perform a Melee Attack.This behavior requires
EntityMemory.LOOKING_TARGETto be registered,EntityMemory.ATTACK_COOLING_DOWNto be absent, andEntityMemory.ATTACK_TARGETwithEntityMemory.NEAREST_VISIBLE_LIVING_ENTITIESto be present.- Parameters:
cooldown- Cooldown, in ticks, before the next attack- Returns:
- Result of Behavior
-
meleeAttack
Makes this Mob perform a Melee Attack, with a cooldown of 3 seconds (60 ticks).This behavior requires
EntityMemory.LOOKING_TARGETto be registered,EntityMemory.ATTACK_COOLING_DOWNto be absent, andEntityMemory.ATTACK_TARGETwithEntityMemory.NEAREST_VISIBLE_LIVING_ENTITIESto be present.- Returns:
- Result of Behavior
-
wakeUp
Wakes up this Mob if it is sleeping.This behavior does not require any memories to run.
- Returns:
- Result of Behavior
-
ringBell
Makes this Mob ring the nearest bell.This behavior requires
EntityMemory.MEETING_POINTto be present.- Returns:
- Result of Behavior
-
reactToBell
Makes this Mob react to a Bell ringing, symbolizing an incoming raid.This behavior requires
EntityMemory.HEARD_BELL_DURATIONto be present.- Returns:
- Result of Behavior
-
interactWithDoor
Makes this Mob interact with the nearest door.This behavior requires
EntityMemory.PATHto be present, andEntityMemory.DOORS_TO_CLOSEwithEntityMemory.NEAREST_LIVING_ENTITIESto be registered.- Returns:
- Result of Behavior
-
sleep
Makes this Mob sleep in a bed.This behavior requires
EntityMemory.HOMEto be present, andEntityMemory.LAST_WOKENto be registered.- Returns:
- Result of Behavior
-
socializeAtBell
This behavior requires
EntityMemory.NEAREST_VISIBLE_LIVING_ENTITIESto be present,EntityMemory.INTERACTION_TARGETto be absent, andEntityMemory.WALKING_TARGETwithEntityMemory.LOOKING_TARGETto be registered.