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 BehaviorResult
backupIfClose
(int minDistance) Makes this Mob back up if it is too close, with no speed modifier.backupIfClose
(int minDistance, float speedModifier) Makes this Mob back up if it is too close.Erases a memory if function returns true.Makes this Mob interact with the nearest door.default @NotNull BehaviorResult
Makes this Mob jump on a Bed, with no speed Modifier.jumpOnBed
(float speedMod) Makes this Mob jump on a Bed.default @NotNull BehaviorResult
Makes this Mob perform a Melee Attack, with a cooldown of 3 seconds (60 ticks).meleeAttack
(int cooldown) Makes this Mob perform a Melee Attack.default @NotNull BehaviorResult
moveToWantedItem
(int minDist) Makes this Entity move to its wanted item, with no speed modifier.default @NotNull BehaviorResult
moveToWantedItem
(int minDist, float speedMod) Makes this Entity move to its wanted item, withrequireTarget
set to true.moveToWantedItem
(int minDist, float speedMod, boolean requireTarget) Makes this Entity move to its wanted item.Makes this Entity become Passive is a Memory is present.Makes this Mob react to a Bell ringing, symbolizing an incoming raid.ringBell()
Makes this Mob ring the nearest bell.sleep()
Makes this Mob sleep in a bed.Makes this Mob socialize at the Village's Bell.wakeUp()
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_TARGET
to be absent,EntityMemory.LOOKING_TARGET
to be registered, andEntityMemory.ATTACK_TARGET
withEntityMemory.NEAREST_VISIBLE_LIVING_ENTITIES
to 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_TARGET
to be absent,EntityMemory.LOOKING_TARGET
to be registered, andEntityMemory.ATTACK_TARGET
withEntityMemory.NEAREST_VISIBLE_LIVING_ENTITIES
to 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_TARGET
andEntityMemory.TICKS_ITEM_PICKUP_COOLDOWN
to be registered, andEntityMemory.NEAREST_VISIBLE_WANTED_ITEM
to be present.Depending on
requireTarget
,EntityMemory.WALKING_TARGET
needs 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_TARGET
needs to be absent, defaults to true)- Returns:
- Result of Behavior
-
moveToWantedItem
Makes this Entity move to its wanted item, withrequireTarget
set to true.This behavior requires
EntityMemory.LOOKING_TARGET
andEntityMemory.TICKS_ITEM_PICKUP_COOLDOWN
to be registered, andEntityMemory.NEAREST_VISIBLE_WANTED_ITEM
withEntityMemory.WALKING_TARGET
to 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_TARGET
andEntityMemory.TICKS_ITEM_PICKUP_COOLDOWN
to be registered, andEntityMemory.NEAREST_VISIBLE_WANTED_ITEM
withEntityMemory.WALKING_TARGET
to 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_BED
to be present, andEntityMemory.WALKING_TARGET
to 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_BED
to be present, andEntityMemory.WALKING_TARGET
to be absent.- Returns:
- Result of Behavior
-
meleeAttack
Makes this Mob perform a Melee Attack.This behavior requires
EntityMemory.LOOKING_TARGET
to be registered,EntityMemory.ATTACK_COOLING_DOWN
to be absent, andEntityMemory.ATTACK_TARGET
withEntityMemory.NEAREST_VISIBLE_LIVING_ENTITIES
to 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_TARGET
to be registered,EntityMemory.ATTACK_COOLING_DOWN
to be absent, andEntityMemory.ATTACK_TARGET
withEntityMemory.NEAREST_VISIBLE_LIVING_ENTITIES
to 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_POINT
to 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_DURATION
to be present.- Returns:
- Result of Behavior
-
interactWithDoor
Makes this Mob interact with the nearest door.This behavior requires
EntityMemory.PATH
to be present, andEntityMemory.DOORS_TO_CLOSE
withEntityMemory.NEAREST_LIVING_ENTITIES
to be registered.- Returns:
- Result of Behavior
-
sleep
Makes this Mob sleep in a bed.This behavior requires
EntityMemory.HOME
to be present, andEntityMemory.LAST_WOKEN
to be registered.- Returns:
- Result of Behavior
-
socializeAtBell
This behavior requires
EntityMemory.NEAREST_VISIBLE_LIVING_ENTITIES
to be present,EntityMemory.INTERACTION_TARGET
to be absent, andEntityMemory.WALKING_TARGET
withEntityMemory.LOOKING_TARGET
to be registered.