Class MinionDataHolder
java.lang.Object
com.binaris.wizardry.capabilities.MinionDataHolder
- All Implemented Interfaces:
MinionData,net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
public class MinionDataHolder
extends Object
implements net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>, MinionData
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.minecraftforge.common.capabilities.Capability<MinionDataHolder>static final net.minecraft.resources.ResourceLocation -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeserializeNBT(net.minecraft.nbt.CompoundTag tag) intGets 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.net.minecraft.nbt.CompoundTagvoidsetLifetime(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(@Nullable 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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.binaris.wizardry.api.content.data.MinionData
updateGoals
-
Field Details
-
LOCATION
public static final net.minecraft.resources.ResourceLocation LOCATION -
INSTANCE
-
-
Constructor Details
-
MinionDataHolder
public MinionDataHolder(net.minecraft.world.entity.Mob mob)
-
-
Method Details
-
getProvider
public net.minecraft.world.entity.Mob getProvider()Description copied from interface:MinionDataGets the mob that this minion data is associated with. Normally you won't need to use this method directly.- Specified by:
getProviderin interfaceMinionData- Returns:
- the mob provider
-
tick
public void tick()Description copied from interface:MinionDataCalled every tick to update the minion's state, including checking its lifetime and spawning particles.- Specified by:
tickin interfaceMinionData
-
getLifetime
public int getLifetime()Description copied from interface:MinionDataGets the lifetime of the minion in ticks.- Specified by:
getLifetimein interfaceMinionData- Returns:
- the lifetime of the minion
-
setLifetime
public void setLifetime(int lifetime) Description copied from interface:MinionDataSets the lifetime of the minion in ticks.- Specified by:
setLifetimein interfaceMinionData- Parameters:
lifetime- the new lifetime of the minion
-
isSummoned
public boolean isSummoned()Description copied from interface:MinionDataDecreases the minion's lifetime by one tick.- Specified by:
isSummonedin interfaceMinionData
-
setSummoned
public void setSummoned(boolean summoned) Description copied from interface:MinionDataSets whether the minion was summoned by a player.- Specified by:
setSummonedin interfaceMinionData- Parameters:
summoned- true if the minion was summoned, false otherwise
-
shouldDeleteGoals
public boolean shouldDeleteGoals()Description copied from interface:MinionDataDetermines whether the minion's goals should be deleted when the minion is created.- Specified by:
shouldDeleteGoalsin interfaceMinionData- Returns:
- true if the goals should be deleted, false otherwise
-
setShouldDeleteGoals
public void setShouldDeleteGoals(boolean shouldDeleteGoals) Description copied from interface:MinionDataSets whether the minion's goals should be deleted when the minion is created.- Specified by:
setShouldDeleteGoalsin interfaceMinionData- Parameters:
shouldDeleteGoals- true to delete the goals, false otherwise
-
shouldFollowOwner
public boolean shouldFollowOwner()Description copied from interface:MinionDataDetermines whether the minion should follow its owner.- Specified by:
shouldFollowOwnerin interfaceMinionData- Returns:
- true if the minion should follow its owner, false otherwise
-
setShouldFollowOwner
public void setShouldFollowOwner(boolean shouldFollowOwner) Description copied from interface:MinionDataSets whether the minion should follow its owner.- Specified by:
setShouldFollowOwnerin interfaceMinionData- Parameters:
shouldFollowOwner- true if the minion should follow its owner, false otherwise
-
searchNearbyTargets
public boolean searchNearbyTargets()Description copied from interface:MinionDataDetermines if the minion should search nearby mobs that can attack the owner and target them. (This avoids attacking allies minions and passive mobs!)- Specified by:
searchNearbyTargetsin interfaceMinionData- Returns:
- true if the minion should search and target nearby mobs based on the target conditions, false otherwise
-
setSearchNearbyTargets
public void setSearchNearbyTargets(boolean searchNearbyTargets) Description copied from interface:MinionDataSets whether the minion should search nearby mobs that can represent a danger to the owner and target them.- Specified by:
setSearchNearbyTargetsin interfaceMinionData- Parameters:
searchNearbyTargets- true if the minion should search and target nearby mobs based on the target conditions, false otherwise
-
getOwnerUUID
Description copied from interface:MinionDataGets the UUID of the owner of the minion.- Specified by:
getOwnerUUIDin interfaceMinionData- Returns:
- the owner's UUID
-
setOwnerUUID
Description copied from interface:MinionDataSets the UUID of the owner of the minion.- Specified by:
setOwnerUUIDin interfaceMinionData- Parameters:
ownerUUID- the owner's UUID
-
getOwner
@Nullable public @Nullable net.minecraft.world.entity.LivingEntity getOwner()Description copied from interface:MinionDataGets the owner entity of the minion.- Specified by:
getOwnerin interfaceMinionData- Returns:
- the owner entity
-
setOwner
public void setOwner(net.minecraft.world.entity.LivingEntity owner) Description copied from interface:MinionDataSets the owner entity of the minion.- Specified by:
setOwnerin interfaceMinionData- Parameters:
owner- the owner entity
-
markGoalRestart
public void markGoalRestart(boolean shouldRestartGoals) Description copied from interface:MinionDataSets 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.
- Specified by:
markGoalRestartin interfaceMinionData- Parameters:
shouldRestartGoals- true to restart the goals, false otherwise
-
goalRestart
public boolean goalRestart()Description copied from interface:MinionDataDetermines 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.
- Specified by:
goalRestartin interfaceMinionData- Returns:
- true if the goals should be restarted, false otherwise
-
serializeNBT
public net.minecraft.nbt.CompoundTag serializeNBT()- Specified by:
serializeNBTin interfacenet.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
-
deserializeNBT
public void deserializeNBT(net.minecraft.nbt.CompoundTag tag) - Specified by:
deserializeNBTin interfacenet.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
-