Interface MinionData
- All Known Implementing Classes:
MinionDataHolder
public interface MinionData
Represents the data associated with a minion entity in the game. A minion is a mob that is summoned from any spell or
ability related to minions. In order to create a very quick and easy implementation of a minion we use this interface
to store all the necessary data and functionality related to minions, this goes such as lifetime, ownership, and any
needed parts to remove from the original mob's goals and add the minion specific ones.
You don't need to implement this interface yourself, as the mod provides default implementations for all mobs that
are designated as minions. Instead, you can use MinionSpell
and related classes to summon and manage minions without worrying about the underlying data handling.
-
Method Summary
Modifier and TypeMethodDescriptionintGets the lifetime of the minion in ticks.@Nullable net.minecraft.world.entity.LivingEntitygetOwner()Gets the owner entity of the minion.@Nullable UUIDGets the UUID of the owner of the minion.net.minecraft.world.entity.MobGets the mob that this minion data is associated with.booleanDetermines whether the minion's original goals should be restarted, this is used when the minion's tick method is called after it has been loaded into the world.booleanDecreases the minion's lifetime by one tick.voidmarkGoalRestart(boolean shouldRestartGoals) Sets whether the minion's original goals should be restarted, this is used when the minion's tick method is called after it has been loaded into the world.booleanDetermines if the minion should search nearby mobs that can attack the owner and target them.voidsetLifetime(int lifetime) Sets the lifetime of the minion in ticks.voidsetOwner(net.minecraft.world.entity.LivingEntity owner) Sets the owner entity of the minion.voidsetOwnerUUID(UUID ownerUUID) Sets the UUID of the owner of the minion.voidsetSearchNearbyTargets(boolean searchNearbyTargets) Sets whether the minion should search nearby mobs that can represent a danger to the owner and target them.voidsetShouldDeleteGoals(boolean shouldDeleteGoals) Sets whether the minion's goals should be deleted when the minion is created.voidsetShouldFollowOwner(boolean shouldFollowOwner) Sets whether the minion should follow its owner.voidsetSummoned(boolean summoned) Sets whether the minion was summoned by a player.booleanDetermines whether the minion's goals should be deleted when the minion is created.booleanDetermines whether the minion should follow its owner.voidtick()Called every tick to update the minion's state, including checking its lifetime and spawning particles.default voidClears all existing goals from the minion's target selectors and optionally the goal selectors, then adds the standard minion goals to follow/defend its owner as appropriate.
-
Method Details
-
getProvider
net.minecraft.world.entity.Mob getProvider()Gets the mob that this minion data is associated with. Normally you won't need to use this method directly.- Returns:
- the mob provider
-
updateGoals
default void updateGoals()Clears all existing goals from the minion's target selectors and optionally the goal selectors, then adds the standard minion goals to follow/defend its owner as appropriate. -
tick
void tick()Called every tick to update the minion's state, including checking its lifetime and spawning particles. -
getLifetime
int getLifetime()Gets the lifetime of the minion in ticks.- Returns:
- the lifetime of the minion
-
setLifetime
void setLifetime(int lifetime) Sets the lifetime of the minion in ticks.- Parameters:
lifetime- the new lifetime of the minion
-
isSummoned
boolean isSummoned()Decreases the minion's lifetime by one tick. -
setSummoned
void setSummoned(boolean summoned) Sets whether the minion was summoned by a player.- Parameters:
summoned- true if the minion was summoned, false otherwise
-
shouldDeleteGoals
boolean shouldDeleteGoals()Determines whether the minion's goals should be deleted when the minion is created.- Returns:
- true if the goals should be deleted, false otherwise
-
setShouldDeleteGoals
void setShouldDeleteGoals(boolean shouldDeleteGoals) Sets whether the minion's goals should be deleted when the minion is created.- Parameters:
shouldDeleteGoals- true to delete the goals, false otherwise
-
shouldFollowOwner
boolean shouldFollowOwner()Determines whether the minion should follow its owner.- Returns:
- true if the minion should follow its owner, false otherwise
-
setShouldFollowOwner
void setShouldFollowOwner(boolean shouldFollowOwner) Sets whether the minion should follow its owner.- Parameters:
shouldFollowOwner- true if the minion should follow its owner, false otherwise
-
searchNearbyTargets
boolean searchNearbyTargets()Determines if the minion should search nearby mobs that can attack the owner and target them. (This avoids attacking allies minions and passive mobs!)- Returns:
- true if the minion should search and target nearby mobs based on the target conditions, false otherwise
-
setSearchNearbyTargets
void setSearchNearbyTargets(boolean searchNearbyTargets) Sets whether the minion should search nearby mobs that can represent a danger to the owner and target them.- Parameters:
searchNearbyTargets- true if the minion should search and target nearby mobs based on the target conditions, false otherwise
-
getOwnerUUID
Gets the UUID of the owner of the minion.- Returns:
- the owner's UUID
-
setOwnerUUID
Sets the UUID of the owner of the minion.- Parameters:
ownerUUID- the owner's UUID
-
getOwner
@Nullable @Nullable net.minecraft.world.entity.LivingEntity getOwner()Gets the owner entity of the minion.- Returns:
- the owner entity
-
setOwner
void setOwner(net.minecraft.world.entity.LivingEntity owner) Sets the owner entity of the minion.- Parameters:
owner- the owner entity
-
markGoalRestart
@Internal void markGoalRestart(boolean shouldRestartGoals) Sets whether the minion's original goals should be restarted, this is used when the minion's tick method is called after it has been loaded into the world.Note: This method is intended for internal use only and should not be called directly or overridden.
- Parameters:
shouldRestartGoals- true to restart the goals, false otherwise
-
goalRestart
@Internal boolean goalRestart()Determines whether the minion's original goals should be restarted, this is used when the minion's tick method is called after it has been loaded into the world.Note: This method is intended for internal use only and should not be called directly or overridden.
- Returns:
- true if the goals should be restarted, false otherwise
-