Package com.binaris.wizardry.cca.entity
Class MinionDataHolder
java.lang.Object
com.binaris.wizardry.cca.entity.MinionDataHolder
- All Implemented Interfaces:
MinionData,dev.onyxstudios.cca.api.v3.component.Component,dev.onyxstudios.cca.api.v3.component.ComponentV3,dev.onyxstudios.cca.api.v3.component.sync.AutoSyncedComponent,dev.onyxstudios.cca.api.v3.component.sync.ComponentPacketWriter,dev.onyxstudios.cca.api.v3.component.sync.PlayerSyncPredicate
public class MinionDataHolder
extends Object
implements MinionData, dev.onyxstudios.cca.api.v3.component.ComponentV3, dev.onyxstudios.cca.api.v3.component.sync.AutoSyncedComponent
-
Constructor Summary
Constructors -
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.Gets 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.voidreadFromNbt(@NotNull net.minecraft.nbt.CompoundTag tag) 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.voidsync()voidtick()Called every tick to update the minion's state, including checking its lifetime and spawning particles.voidwriteToNbt(net.minecraft.nbt.CompoundTag tag) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.onyxstudios.cca.api.v3.component.sync.AutoSyncedComponent
applySyncPacket, shouldSyncWith, writeSyncPacketMethods inherited from interface dev.onyxstudios.cca.api.v3.component.Component
equalsMethods inherited from interface com.binaris.wizardry.api.content.data.MinionData
updateGoals
-
Constructor Details
-
MinionDataHolder
public MinionDataHolder(net.minecraft.world.entity.Mob provider)
-
-
Method Details
-
sync
public void sync() -
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
-
readFromNbt
public void readFromNbt(@NotNull @NotNull net.minecraft.nbt.CompoundTag tag) - Specified by:
readFromNbtin interfacedev.onyxstudios.cca.api.v3.component.Component
-
writeToNbt
public void writeToNbt(net.minecraft.nbt.CompoundTag tag) - Specified by:
writeToNbtin interfacedev.onyxstudios.cca.api.v3.component.Component
-