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
    Modifier and Type
    Class
    Description
    static class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final net.minecraftforge.common.capabilities.Capability<MinionDataHolder>
     
    static final net.minecraft.resources.ResourceLocation
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    MinionDataHolder(net.minecraft.world.entity.Mob mob)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    deserializeNBT(net.minecraft.nbt.CompoundTag tag)
     
    int
    Gets the lifetime of the minion in ticks.
    @Nullable net.minecraft.world.entity.LivingEntity
    Gets the owner entity of the minion.
    @Nullable UUID
    Gets the UUID of the owner of the minion.
    net.minecraft.world.entity.Mob
    Gets the mob that this minion data is associated with.
    boolean
    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.
    boolean
    Decreases the minion's lifetime by one tick.
    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.
    boolean
    Determines if the minion should search nearby mobs that can attack the owner and target them.
    net.minecraft.nbt.CompoundTag
     
    void
    setLifetime(int lifetime)
    Sets the lifetime of the minion in ticks.
    void
    setOwner(net.minecraft.world.entity.LivingEntity owner)
    Sets the owner entity of the minion.
    void
    setOwnerUUID(@Nullable UUID ownerUUID)
    Sets the UUID of the owner of the minion.
    void
    setSearchNearbyTargets(boolean searchNearbyTargets)
    Sets whether the minion should search nearby mobs that can represent a danger to the owner and target them.
    void
    setShouldDeleteGoals(boolean shouldDeleteGoals)
    Sets whether the minion's goals should be deleted when the minion is created.
    void
    setShouldFollowOwner(boolean shouldFollowOwner)
    Sets whether the minion should follow its owner.
    void
    setSummoned(boolean summoned)
    Sets whether the minion was summoned by a player.
    boolean
    Determines whether the minion's goals should be deleted when the minion is created.
    boolean
    Determines whether the minion should follow its owner.
    void
    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, wait

    Methods inherited from interface com.binaris.wizardry.api.content.data.MinionData

    updateGoals
  • Field Details

    • LOCATION

      public static final net.minecraft.resources.ResourceLocation LOCATION
    • INSTANCE

      public static final net.minecraftforge.common.capabilities.Capability<MinionDataHolder> 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: MinionData
      Gets the mob that this minion data is associated with. Normally you won't need to use this method directly.
      Specified by:
      getProvider in interface MinionData
      Returns:
      the mob provider
    • tick

      public void tick()
      Description copied from interface: MinionData
      Called every tick to update the minion's state, including checking its lifetime and spawning particles.
      Specified by:
      tick in interface MinionData
    • getLifetime

      public int getLifetime()
      Description copied from interface: MinionData
      Gets the lifetime of the minion in ticks.
      Specified by:
      getLifetime in interface MinionData
      Returns:
      the lifetime of the minion
    • setLifetime

      public void setLifetime(int lifetime)
      Description copied from interface: MinionData
      Sets the lifetime of the minion in ticks.
      Specified by:
      setLifetime in interface MinionData
      Parameters:
      lifetime - the new lifetime of the minion
    • isSummoned

      public boolean isSummoned()
      Description copied from interface: MinionData
      Decreases the minion's lifetime by one tick.
      Specified by:
      isSummoned in interface MinionData
    • setSummoned

      public void setSummoned(boolean summoned)
      Description copied from interface: MinionData
      Sets whether the minion was summoned by a player.
      Specified by:
      setSummoned in interface MinionData
      Parameters:
      summoned - true if the minion was summoned, false otherwise
    • shouldDeleteGoals

      public boolean shouldDeleteGoals()
      Description copied from interface: MinionData
      Determines whether the minion's goals should be deleted when the minion is created.
      Specified by:
      shouldDeleteGoals in interface MinionData
      Returns:
      true if the goals should be deleted, false otherwise
    • setShouldDeleteGoals

      public void setShouldDeleteGoals(boolean shouldDeleteGoals)
      Description copied from interface: MinionData
      Sets whether the minion's goals should be deleted when the minion is created.
      Specified by:
      setShouldDeleteGoals in interface MinionData
      Parameters:
      shouldDeleteGoals - true to delete the goals, false otherwise
    • shouldFollowOwner

      public boolean shouldFollowOwner()
      Description copied from interface: MinionData
      Determines whether the minion should follow its owner.
      Specified by:
      shouldFollowOwner in interface MinionData
      Returns:
      true if the minion should follow its owner, false otherwise
    • setShouldFollowOwner

      public void setShouldFollowOwner(boolean shouldFollowOwner)
      Description copied from interface: MinionData
      Sets whether the minion should follow its owner.
      Specified by:
      setShouldFollowOwner in interface MinionData
      Parameters:
      shouldFollowOwner - true if the minion should follow its owner, false otherwise
    • searchNearbyTargets

      public boolean searchNearbyTargets()
      Description copied from interface: MinionData
      Determines 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:
      searchNearbyTargets in interface MinionData
      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: MinionData
      Sets whether the minion should search nearby mobs that can represent a danger to the owner and target them.
      Specified by:
      setSearchNearbyTargets in interface MinionData
      Parameters:
      searchNearbyTargets - true if the minion should search and target nearby mobs based on the target conditions, false otherwise
    • getOwnerUUID

      @Nullable public @Nullable UUID getOwnerUUID()
      Description copied from interface: MinionData
      Gets the UUID of the owner of the minion.
      Specified by:
      getOwnerUUID in interface MinionData
      Returns:
      the owner's UUID
    • setOwnerUUID

      public void setOwnerUUID(@Nullable @Nullable UUID ownerUUID)
      Description copied from interface: MinionData
      Sets the UUID of the owner of the minion.
      Specified by:
      setOwnerUUID in interface MinionData
      Parameters:
      ownerUUID - the owner's UUID
    • getOwner

      @Nullable public @Nullable net.minecraft.world.entity.LivingEntity getOwner()
      Description copied from interface: MinionData
      Gets the owner entity of the minion.
      Specified by:
      getOwner in interface MinionData
      Returns:
      the owner entity
    • setOwner

      public void setOwner(net.minecraft.world.entity.LivingEntity owner)
      Description copied from interface: MinionData
      Sets the owner entity of the minion.
      Specified by:
      setOwner in interface MinionData
      Parameters:
      owner - the owner entity
    • markGoalRestart

      public void markGoalRestart(boolean shouldRestartGoals)
      Description copied from interface: MinionData
      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.

      Specified by:
      markGoalRestart in interface MinionData
      Parameters:
      shouldRestartGoals - true to restart the goals, false otherwise
    • goalRestart

      public boolean goalRestart()
      Description copied from interface: MinionData
      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.

      Specified by:
      goalRestart in interface MinionData
      Returns:
      true if the goals should be restarted, false otherwise
    • serializeNBT

      public net.minecraft.nbt.CompoundTag serializeNBT()
      Specified by:
      serializeNBT in interface net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
    • deserializeNBT

      public void deserializeNBT(net.minecraft.nbt.CompoundTag tag)
      Specified by:
      deserializeNBT in interface net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>