Class MoveSkill

java.lang.Object
com.pixelmonmod.pixelmon.api.moveskills.MoveSkill

public class MoveSkill extends Object
Represents a usable move skill. All move skills are instances of this object.

Creating a new move skill can be done by adding it to the MOVE_SKILLS list and using register(net.minecraft.server.level.ServerPlayer) when a player logs in.

Conversely, move skills can be unregistered by running unregister(net.minecraft.server.level.ServerPlayer) when a player logs in.

New move skills can be created without any client-side modding, but the sprite selection is limited to those provided for Pixelmon's default move skills.

Since:
October 6, 2019
  • Constructor Details

    • MoveSkill

      public MoveSkill(String id)
    • MoveSkill

      public MoveSkill(String id, String name)
  • Method Details

    • addMoveSkill

      public static MoveSkill addMoveSkill(MoveSkill skill)
      Inserts a given move skill into the map of available move skills.
      Parameters:
      skill - The move skill to add.
      Returns:
      The previous value associated with the id of the given move skill, or null if none.
    • removeMoveSkill

      public static MoveSkill removeMoveSkill(MoveSkill moveSkill)
      Removes a given move skill from the map of available move skills.
      Parameters:
      moveSkill - The move skill to remove.
      Returns:
      The now-removed value associated with the given id, or null if nothing was removed.
    • removeMoveSkill

      public static MoveSkill removeMoveSkill(String id)
      Removes a given move skill from the map of available move skills.
      Parameters:
      id - The id of the move skill to remove.
      Returns:
      The now-removed value associated with the given id, or null if nothing was removed.
    • clearMoveSkills

      public static void clearMoveSkills()
      Removes all move skills from the map of available move skills.
    • forEachMoveSkill

      public static void forEachMoveSkill(Consumer<MoveSkill> forEach)
      Performs the given consumer for each move skill present.
      Parameters:
      forEach - The action to perform for each move skill.
    • isMoveSkill

      public static boolean isMoveSkill(String id)
      Checks whether the given id matches any move skill's id.
      Parameters:
      id - The id to look for.
      Returns:
      Whether a move skill was found with the given id
    • getMoveSkillByID

      public static MoveSkill getMoveSkillByID(String id)
      Gets the move skill for a given id, or null if none match.
      Parameters:
      id - The id to look for.
      Returns:
      The found move skill, or null if none.
    • getAllMoveSkills

      public static List<MoveSkill> getAllMoveSkills()
      Gets a new list containing all move skills.
      Returns:
      A list of all move skills.
    • getMoveSkills

      public static List<MoveSkill> getMoveSkills(Pokemon pokemon)
      Gets all the move skills that the given Pokémon is capable of using, ignoring cooldowns.
      Parameters:
      pokemon - The Pokémon to check.
      Returns:
      The move skills usable by the given Pokémon.
    • id

      public String id()
      Gets the id of this move skill.
      Returns:
      The id of this move skill.
    • name

      public MoveSkill name(String name)
      Sets the name of this move skill.
      Parameters:
      name - The new name of this move skill.
      Returns:
      This move skill.
    • name

      public String name()
      Gets the name of this move skill.
      Returns:
      The name of this move skill.
    • descriptions

      public MoveSkill descriptions(String... descriptions)
      Adds description lines to this move skill.
      Parameters:
      descriptions - The array of new description lines to add to this move skill.
      Returns:
      This move skill.
    • descriptions

      public MoveSkill descriptions(Collection<String> descriptions)
      Adds description lines to this move skill.
      Parameters:
      descriptions - The collection of new description lines to add to this move skill.
      Returns:
      This move skill.
    • descriptions

      public List<String> descriptions()
      Gets the description lines of this move skill.
      Returns:
      The description lines of this move skill.
    • sprite

      public MoveSkill sprite(String sprite)
      Sets the sprite of this move skill.
      Parameters:
      sprite - The new sprite of this move skill.
      Returns:
      This move skill.
    • sprite

      public MoveSkill sprite(net.minecraft.resources.ResourceLocation sprite)
      Sets the sprite of this move skill.
      Parameters:
      sprite - The new sprite of this move skill.
      Returns:
      This move skill.
    • sprite

      public net.minecraft.resources.ResourceLocation sprite()
      Gets the sprite of this move skill.
      Returns:
      The sprite of this move skill.
    • cooldown

      public MoveSkill cooldown(int cooldown)
      Sets the cooldown, in ticks, of this move skill.
      Parameters:
      cooldown - The new cooldown of this move skill.
      Returns:
      This move skill.
    • cooldown

      public int cooldown()
      Gets the cooldown, in ticks, of this move skill.
      Returns:
      The cooldown of this move skill.
    • range

      public MoveSkill range(int range)
      Sets the range, in blocks, of this move skill.
      Parameters:
      range - The new range of this move skill.
      Returns:
      This move skill.
    • range

      public int range()
      Gets the range, in blocks, of this move skill.
      Returns:
      The range of this move skill.
    • usePP

      public MoveSkill usePP(boolean usePP)
      Sets whether this move skill should consume PP or not.
      Parameters:
      usePP - Whether this move skill should consume PP.
      Returns:
      This move skill.
    • usePP

      public boolean usePP()
      Gets whether this move skill will consume PP or not.
      Returns:
      Whether this move skill will consume PP.
    • addAnyMoves

      public MoveSkill addAnyMoves(String... attacks)
      Adds attacks to the set of moves which will grant this move skill if a Pokémon knows any one of them.
      Parameters:
      attacks - The attacks to add.
      Returns:
      This move skill.
    • setAnyMoves

      public MoveSkill setAnyMoves(Collection<ImmutableAttack> attacks)
      Sets the set of moves which will grant this move skill if a Pokémon knows any one of them.
      Parameters:
      attacks - The attacks to use.
      Returns:
      This move skill.
    • addCombinationMoves

      public MoveSkill addCombinationMoves(String... attacks)
      Adds attacks to the set of moves which will grant this move skill if a Pokémon knows all of them.
      Parameters:
      attacks - The attacks to add.
      Returns:
      This move skill.
    • setCombinationMoves

      public MoveSkill setCombinationMoves(Collection<ImmutableAttack> attacks)
      Sets the set of moves which will grant this move skill if a Pokémon knows all of them.
      Parameters:
      attacks - The attacks to use.
      Returns:
      This move skill.
    • addAbleSpecs

      public MoveSkill addAbleSpecs(String... specs)
      Adds to the set of specs which are able to use this move skill.
      Parameters:
      specs - The specs to add.
      Returns:
      This move skill.
    • setAbleSpecs

      public MoveSkill setAbleSpecs(Collection<PokemonSpecification> specs)
      Sets the set of specs which are able to use this move skill.
      Parameters:
      specs - The specs to use.
      Returns:
      This move skill.
    • addIntrinsicSpecs

      public MoveSkill addIntrinsicSpecs(String... specs)
      Adds to the set of specs which are able to use this move skill, regardless of all other checks.
      Parameters:
      specs - The specs to add.
      Returns:
      This move skill.
    • setIntrinsicSpecs

      public MoveSkill setIntrinsicSpecs(Collection<PokemonSpecification> specs)
      Sets the set of specs which are able to use this move skill, regardless of all other checks.
      Parameters:
      specs - The specs to use.
      Returns:
      This move skill.
    • behaviourNoTarget

      public MoveSkill behaviourNoTarget(ToIntFunction<PixelmonEntity> behaviour)
      Sets the behaviour of this move skill with no target.
      Parameters:
      behaviour - The behaviour, returning the cooldown value.
      Returns:
      This move skill.
    • behaviourPokemonTarget

      public MoveSkill behaviourPokemonTarget(BiFunction<PixelmonEntity,PixelmonEntity,Integer> behaviour)
      Sets the behaviour of this move skill with a Pokémon target.
      Parameters:
      behaviour - The behaviour, returning the cooldown value.
      Returns:
      This move skill.
    • behaviourBlockTarget

      public MoveSkill behaviourBlockTarget(BiFunction<PixelmonEntity,net.minecraft.util.Tuple<net.minecraft.core.BlockPos,net.minecraft.core.Direction>,Integer> behaviour)
      Sets the behaviour of this move skill with a block target.
      Parameters:
      behaviour - The behaviour, returning the cooldown value.
      Returns:
      This move skill.
    • behaviourPlayerTarget

      public MoveSkill behaviourPlayerTarget(BiFunction<PixelmonEntity,net.minecraft.server.level.ServerPlayer,Integer> behaviour)
      Sets the behaviour of this move skill with a player target.
      Parameters:
      behaviour - The behaviour, returning the cooldown value.
      Returns:
      This move skill.
    • behaviour

      public MoveSkill behaviour(BiFunction<PixelmonEntity,Object,Integer> behaviour, MoveSkill.TargetType... targetTypes)
      Sets the behaviour of this move skill for multiple kinds of target.
      Parameters:
      behaviour - The behaviours, returning the cooldown value.
      targetTypes - The kinds of target to set behaviour for.
      Returns:
      This move skill.
    • onUsed

      public void onUsed(PixelmonEntity pixelmon, Object data, MoveSkill.TargetType targetType)
    • applyCooldown

      public void applyCooldown(Pokemon pokemon, int cooldownTicks)
    • hasMoveSkill

      public boolean hasMoveSkill(Pokemon pokemon)
    • hasTargetType

      public boolean hasTargetType(MoveSkill.TargetType targetType)
    • checkForPP

      public boolean checkForPP(Pokemon pokemon)
    • takePP

      public void takePP(Pokemon pokemon)
    • matchesIntrinsicSpecs

      public boolean matchesIntrinsicSpecs(Pokemon pokemon)
    • matchesAbleSpecs

      public boolean matchesAbleSpecs(Pokemon pokemon)
    • matchesCombinationMoves

      public boolean matchesCombinationMoves(Pokemon pokemon)
    • matchesAnyMoves

      public boolean matchesAnyMoves(Pokemon pokemon)
    • register

      public void register(net.minecraft.server.level.ServerPlayer player)
    • unregister

      public void unregister(net.minecraft.server.level.ServerPlayer player)
    • writeAnyMoves

      @Internal public void writeAnyMoves(net.minecraft.network.FriendlyByteBuf buffer)
    • writeCombinationMoves

      @Internal public void writeCombinationMoves(net.minecraft.network.FriendlyByteBuf buffer)
    • writeAbleSpecs

      @Internal public void writeAbleSpecs(net.minecraft.network.FriendlyByteBuf buffer)
    • writeIntrinsicSpecs

      @Internal public void writeIntrinsicSpecs(net.minecraft.network.FriendlyByteBuf buffer)
    • writeBehaviours

      @Internal public void writeBehaviours(net.minecraft.network.FriendlyByteBuf buffer)
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object