Interface MagicHelper


public interface MagicHelper
Helper for operations related to a Player's MagicAttachment.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addAffinityDepth(net.minecraft.world.entity.player.Player player, Map<net.minecraft.core.Holder<Affinity>, Double> affinities)
    Adds to the given Player's Affinity depth.
    void
    addAffinityDepth(net.minecraft.world.entity.player.Player player, Map<net.minecraft.core.Holder<Affinity>, Double> affinities, boolean bypassLocks, boolean commandSource)
    Adds to the given Player's Affinity depth.
    void
    addAffinityDepth(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<Affinity> affinity, double depth)
    Adds to the given Player's Affinity depth.
    void
    addAffinityDepth(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<Affinity> affinity, double depth, boolean bypassLocks, boolean commandSource)
    Adds to the given Player's Affinity depth.
    void
    addLevel(net.minecraft.world.entity.player.Player player, int level)
     
    void
    addSkillPoint(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<SkillPoint> skillPoint)
    Adds one SkillPoint to the Player.
    void
    addSkillPoint(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<SkillPoint> skillPoint, int amount)
    Adds SkillPoints to the Player.
    void
    addXp(net.minecraft.world.entity.player.Player player, double xp)
     
    void
    applyAffinityShift(net.minecraft.world.entity.player.Player player, Map<net.minecraft.core.Holder<Affinity>, Double> affinityShifts)
    Applies Affinity shifts to the given Player.
    void
    applyAffinityShift(net.minecraft.world.entity.player.Player player, Map<net.minecraft.core.Holder<Affinity>, Double> affinityShifts, boolean bypassLocks, boolean commandSource)
    Applies Affinity shifts to the given Player.
    void
    applyAffinityShift(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<Affinity> affinity, double shift)
    Applies an Affinity shift to the given Player.
    void
    applyAffinityShift(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<Affinity> affinity, double shift, boolean bypassLocks, boolean commandSource)
    Applies an Affinity shift to the given Player.
    boolean
    canLearn(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<Skill> skill)
     
    void
    forget(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<Skill> skill)
    Removes the given Skill from the Player's known Skills.
    void
    forgetAll(net.minecraft.world.entity.player.Player player)
    Removes all Skills from the Player's known Skills.
    double
    getAffinityDepth(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<Affinity> affinity)
     
    List<? extends net.minecraft.core.Holder<Skill>>
    getKnown(net.minecraft.world.entity.player.Player player)
     
    int
    getLevel(net.minecraft.world.entity.player.Player player)
     
    int
    getSkillPoint(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<SkillPoint> skillPoint)
     
    List<? extends net.minecraft.core.Holder<Skill>>
    getUnknown(net.minecraft.world.entity.player.Player player)
     
    double
    getXp(net.minecraft.world.entity.player.Player player)
     
    double
    getXpForNextLevel(int level)
    If a Player is at the given level, calculate how much xp is required for the next level.
    void
    initiateMagic(net.minecraft.world.entity.player.Player player)
    Initiates magic on the given Player, setting them to level 1 and granting some extra skill points.
    boolean
    knows(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<Skill> skill)
     
    boolean
    knowsMagic(net.minecraft.world.entity.player.Player player)
     
    void
    learn(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<Skill> skill)
    Adds the given Skill to the Player's known Skills.
    void
    learnAll(net.minecraft.world.entity.player.Player player)
    Adds all Skills to the Player's known Skills.
    void
    lockAffinities(net.minecraft.world.entity.player.Player player)
    Locks the Player's Affinity depths.
    void
    setAffinityDepth(net.minecraft.world.entity.player.Player player, Map<net.minecraft.core.Holder<Affinity>, Double> affinities)
    Sets the given Player's Affinity depths.
    void
    setAffinityDepth(net.minecraft.world.entity.player.Player player, Map<net.minecraft.core.Holder<Affinity>, Double> affinities, boolean bypassLocks, boolean commandSource)
    Sets the given Player's Affinity depths.
    void
    setAffinityDepth(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<Affinity> affinity, double depth)
    Sets the given Player's Affinity depth.
    void
    setAffinityDepth(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<Affinity> affinity, double depth, boolean bypassLocks, boolean commandSource)
    Sets the given Player's Affinity depth.
    void
    setLevel(net.minecraft.world.entity.player.Player player, int level)
     
    void
    setSkillPoint(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<SkillPoint> skillPoint, int amount)
    Sets SkillPoints on the Player.
    void
    setXp(net.minecraft.world.entity.player.Player player, double xp)
     
    void
    unlockAffinities(net.minecraft.world.entity.player.Player player)
    Unlocks the Player's Affinity depths.
    void
    updateAffinityLock(net.minecraft.world.entity.player.Player player)
    Sets the Player's Affinity depth lock depending on whether there is an affinity at 100% or not.
  • Method Details

    • getLevel

      int getLevel(net.minecraft.world.entity.player.Player player)
      Parameters:
      player - The Player to get the level for.
      Returns:
      The given Player's level.
    • getXp

      double getXp(net.minecraft.world.entity.player.Player player)
      Parameters:
      player - The Player to get the xp for.
      Returns:
      The given Player's xp.
    • getXpForNextLevel

      double getXpForNextLevel(int level)
      If a Player is at the given level, calculate how much xp is required for the next level.
      Parameters:
      level - The current level.
      Returns:
      The xp required for the next level.
    • addLevel

      void addLevel(net.minecraft.world.entity.player.Player player, int level)
      Parameters:
      player - The Player to add the levels for.
      level - The levels to add.
    • setLevel

      void setLevel(net.minecraft.world.entity.player.Player player, int level)
      Parameters:
      player - The Player to set the level for.
      level - The level to set.
    • addXp

      void addXp(net.minecraft.world.entity.player.Player player, double xp)
      Parameters:
      player - The Player to add the xp for.
      xp - The xp to add.
    • setXp

      void setXp(net.minecraft.world.entity.player.Player player, double xp)
      Parameters:
      player - The Player to set the xp for.
      xp - The xp to set.
    • knowsMagic

      boolean knowsMagic(net.minecraft.world.entity.player.Player player)
      Parameters:
      player - The Player to query.
      Returns:
      Whether the given Player knows magic and can interact with various systems added by the mod. This is always true if the player is in creative mode.
    • initiateMagic

      void initiateMagic(net.minecraft.world.entity.player.Player player)
      Initiates magic on the given Player, setting them to level 1 and granting some extra skill points. By default, this happens when they take an Arcane Compendium in the inventory for the first time.
      Parameters:
      player - The Player to initiate magic on.
    • knows

      boolean knows(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<Skill> skill)
      Parameters:
      player - The Player to query.
      skill - The Skill to check for.
      Returns:
      Whether the Player knows the given Skill.
    • canLearn

      boolean canLearn(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<Skill> skill)
      Parameters:
      player - The Player to query.
      skill - The Skill to check for.
      Returns:
      Whether the Player does not know, but meets the requirements to learn the given Skill.
    • getKnown

      List<? extends net.minecraft.core.Holder<Skill>> getKnown(net.minecraft.world.entity.player.Player player)
      Parameters:
      player - The Player to query.
      Returns:
      A List of all Skills the Player currently knows.
    • getUnknown

      List<? extends net.minecraft.core.Holder<Skill>> getUnknown(net.minecraft.world.entity.player.Player player)
      Parameters:
      player - The Player to query.
      Returns:
      A List of all Skills the Player does not currently know.
    • learn

      void learn(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<Skill> skill)
      Adds the given Skill to the Player's known Skills.
      Parameters:
      player - The Player to add the Skill to.
      skill - The Skill to add.
    • forget

      void forget(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<Skill> skill)
      Removes the given Skill from the Player's known Skills.
      Parameters:
      player - The Player to remove the Skill from.
      skill - The Skill to remove.
    • learnAll

      void learnAll(net.minecraft.world.entity.player.Player player)
      Adds all Skills to the Player's known Skills.
      Parameters:
      player - The Player to add the Skills to.
    • forgetAll

      void forgetAll(net.minecraft.world.entity.player.Player player)
      Removes all Skills from the Player's known Skills.
      Parameters:
      player - The Player to remove the Skills from.
    • getSkillPoint

      int getSkillPoint(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<SkillPoint> skillPoint)
      Parameters:
      player - The Player to query.
      skillPoint - The SkillPoint to check.
      Returns:
      The amount of SkillPoints the Player has.
    • addSkillPoint

      void addSkillPoint(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<SkillPoint> skillPoint, int amount)
      Adds SkillPoints to the Player.
      Parameters:
      player - The Player to add the SkillPoints to.
      skillPoint - The SkillPoint to add.
      amount - The amount of SkillPoints to add.
    • addSkillPoint

      void addSkillPoint(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<SkillPoint> skillPoint)
      Adds one SkillPoint to the Player.
      Parameters:
      player - The Player to add the SkillPoint to.
      skillPoint - The SkillPoint to add.
    • setSkillPoint

      void setSkillPoint(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<SkillPoint> skillPoint, int amount)
      Sets SkillPoints on the Player.
      Parameters:
      player - The Player to set the SkillPoints on.
      skillPoint - The SkillPoint to set.
      amount - The amount of SkillPoints to set.
    • getAffinityDepth

      double getAffinityDepth(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<Affinity> affinity)
      Parameters:
      player - The Player to query.
      affinity - The Affinity to query.
      Returns:
      The Affinity depth of the given Player, in the range [0, 1].
    • setAffinityDepth

      void setAffinityDepth(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<Affinity> affinity, double depth)
      Sets the given Player's Affinity depth. Will not bypass locks.
      Parameters:
      player - The Player to set the Affinity depth on.
      affinity - The Affinity to set the depth for.
      depth - The depth to set.
    • setAffinityDepth

      void setAffinityDepth(net.minecraft.world.entity.player.Player player, Map<net.minecraft.core.Holder<Affinity>, Double> affinities)
      Sets the given Player's Affinity depths. Will not bypass locks.
      Parameters:
      player - The Player to set the Affinity depth on.
      affinities - The Affinity depths to set.
    • setAffinityDepth

      void setAffinityDepth(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<Affinity> affinity, double depth, boolean bypassLocks, boolean commandSource)
      Sets the given Player's Affinity depth.
      Parameters:
      player - The Player to set the Affinity depth on.
      affinity - The Affinity to set the depth for.
      depth - The depth to set.
      bypassLocks - If true, bypasses locks.
      commandSource - Whether the method was called from a command.
    • setAffinityDepth

      void setAffinityDepth(net.minecraft.world.entity.player.Player player, Map<net.minecraft.core.Holder<Affinity>, Double> affinities, boolean bypassLocks, boolean commandSource)
      Sets the given Player's Affinity depths.
      Parameters:
      player - The Player to set the Affinity depths on.
      affinities - The Affinity depths to set.
      bypassLocks - If true, bypasses locks.
      commandSource - Whether the method was called from a command.
    • addAffinityDepth

      void addAffinityDepth(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<Affinity> affinity, double depth)
      Adds to the given Player's Affinity depth. Will not bypass locks.
      Parameters:
      player - The Player to add the Affinity depth to.
      affinity - The Affinity to add the depth for.
      depth - The depth to add.
    • addAffinityDepth

      void addAffinityDepth(net.minecraft.world.entity.player.Player player, Map<net.minecraft.core.Holder<Affinity>, Double> affinities)
      Adds to the given Player's Affinity depth. Will not bypass locks.
      Parameters:
      player - The Player to add the Affinity depths to.
      affinities - The Affinity depths to add.
    • addAffinityDepth

      void addAffinityDepth(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<Affinity> affinity, double depth, boolean bypassLocks, boolean commandSource)
      Adds to the given Player's Affinity depth.
      Parameters:
      player - The Player to add the Affinity depth to.
      affinity - The Affinity to add the depth for.
      depth - The depth to add.
      bypassLocks - If true, bypasses locks.
      commandSource - Whether the method was called from a command.
    • addAffinityDepth

      void addAffinityDepth(net.minecraft.world.entity.player.Player player, Map<net.minecraft.core.Holder<Affinity>, Double> affinities, boolean bypassLocks, boolean commandSource)
      Adds to the given Player's Affinity depth.
      Parameters:
      player - The Player to add the Affinity depths to.
      affinities - The Affinity depths to add.
      bypassLocks - If true, bypasses locks.
      commandSource - Whether the method was called from a command.
    • applyAffinityShift

      void applyAffinityShift(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<Affinity> affinity, double shift)
      Applies an Affinity shift to the given Player. It sets the Affinity change itself, as well as modifying the adjacent and opposite Affinitys. Will not bypass locks.
      Parameters:
      player - The Player to apply the Affinity shift to.
      affinity - The Affinity to apply the shift for.
      shift - The shift to apply.
    • applyAffinityShift

      void applyAffinityShift(net.minecraft.world.entity.player.Player player, Map<net.minecraft.core.Holder<Affinity>, Double> affinityShifts)
      Applies Affinity shifts to the given Player. It sets the Affinity changes itself, as well as modifying the adjacent and opposite Affinitys. Will not bypass locks.
      Parameters:
      player - The Player to apply the Affinity shifts to.
      affinityShifts - The Affinity shifts to apply.
    • applyAffinityShift

      void applyAffinityShift(net.minecraft.world.entity.player.Player player, net.minecraft.core.Holder<Affinity> affinity, double shift, boolean bypassLocks, boolean commandSource)
      Applies an Affinity shift to the given Player. It sets the Affinity change itself, as well as modifying the adjacent and opposite Affinitys.
      Parameters:
      player - The Player to apply the Affinity shift to.
      affinity - The Affinity to apply the shift for.
      shift - The shift to apply.
      bypassLocks - If true, bypasses locks.
      commandSource - Whether the method was called from a command.
    • applyAffinityShift

      void applyAffinityShift(net.minecraft.world.entity.player.Player player, Map<net.minecraft.core.Holder<Affinity>, Double> affinityShifts, boolean bypassLocks, boolean commandSource)
      Applies Affinity shifts to the given Player. It sets the Affinity changes itself, as well as modifying the adjacent and opposite Affinitys.
      Parameters:
      player - The Player to apply the Affinity shifts to.
      affinityShifts - The Affinity shifts to apply.
      bypassLocks - If true, bypasses locks.
      commandSource - Whether the method was called from a command.
    • lockAffinities

      void lockAffinities(net.minecraft.world.entity.player.Player player)
      Locks the Player's Affinity depths.
      Parameters:
      player - The Player to lock the Affinity depths of.
      See Also:
    • unlockAffinities

      void unlockAffinities(net.minecraft.world.entity.player.Player player)
      Unlocks the Player's Affinity depths.
      Parameters:
      player - The Player to unlock the Affinity depths of.
      See Also:
    • updateAffinityLock

      void updateAffinityLock(net.minecraft.world.entity.player.Player player)
      Sets the Player's Affinity depth lock depending on whether there is an affinity at 100% or not.
      Parameters:
      player - The Player to set the Affinity depth lock for.