Class MoveSkill
java.lang.Object
com.pixelmonmod.pixelmon.api.moveskills.MoveSkill
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
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddAbleSpecs
(String... specs) Adds to the set of specs which are able to use this move skill.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.addCombinationMoves
(String... attacks) Adds attacks to the set of moves which will grant this move skill if a Pokémon knows all of them.addIntrinsicSpecs
(String... specs) Adds to the set of specs which are able to use this move skill, regardless of all other checks.static MoveSkill
addMoveSkill
(MoveSkill skill) Inserts a given move skill into the map of available move skills.void
applyCooldown
(Pokemon pokemon, int cooldownTicks) behaviour
(BiFunction<PixelmonEntity, Object, Integer> behaviour, MoveSkill.TargetType... targetTypes) Sets the behaviour of this move skill for multiple kinds of target.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.behaviourNoTarget
(ToIntFunction<PixelmonEntity> behaviour) Sets the behaviour of this move skill with no target.behaviourPlayerTarget
(BiFunction<PixelmonEntity, net.minecraft.server.level.ServerPlayer, Integer> behaviour) Sets the behaviour of this move skill with a player target.Sets the behaviour of this move skill with a Pokémon target.boolean
checkForPP
(Pokemon pokemon) static void
Removes all move skills from the map of available move skills.int
cooldown()
Gets the cooldown, in ticks, of this move skill.cooldown
(int cooldown) Sets the cooldown, in ticks, of this move skill.Gets the description lines of this move skill.descriptions
(String... descriptions) Adds description lines to this move skill.descriptions
(Collection<String> descriptions) Adds description lines to this move skill.boolean
static void
forEachMoveSkill
(Consumer<MoveSkill> forEach) Performs the given consumer for each move skill present.Gets a new list containing all move skills.static MoveSkill
Gets the move skill for a given id, or null if none match.getMoveSkills
(Pokemon pokemon) Gets all the move skills that the given Pokémon is capable of using, ignoring cooldowns.int
hashCode()
boolean
hasMoveSkill
(Pokemon pokemon) boolean
hasTargetType
(MoveSkill.TargetType targetType) id()
Gets the id of this move skill.static boolean
isMoveSkill
(String id) Checks whether the given id matches any move skill's id.boolean
matchesAbleSpecs
(Pokemon pokemon) boolean
matchesAnyMoves
(Pokemon pokemon) boolean
matchesCombinationMoves
(Pokemon pokemon) boolean
matchesIntrinsicSpecs
(Pokemon pokemon) name()
Gets the name of this move skill.Sets the name of this move skill.void
onUsed
(PixelmonEntity pixelmon, Object data, MoveSkill.TargetType targetType) int
range()
Gets the range, in blocks, of this move skill.range
(int range) Sets the range, in blocks, of this move skill.void
register
(net.minecraft.server.level.ServerPlayer player) static MoveSkill
removeMoveSkill
(MoveSkill moveSkill) Removes a given move skill from the map of available move skills.static MoveSkill
Removes a given move skill from the map of available move skills.Sets the set of specs which are able to use this move skill.setAnyMoves
(Collection<ImmutableAttack> attacks) Sets the set of moves which will grant this move skill if a Pokémon knows any one of them.setCombinationMoves
(Collection<ImmutableAttack> attacks) Sets the set of moves which will grant this move skill if a Pokémon knows all of them.Sets the set of specs which are able to use this move skill, regardless of all other checks.net.minecraft.resources.ResourceLocation
sprite()
Gets the sprite of this move skill.Sets the sprite of this move skill.sprite
(net.minecraft.resources.ResourceLocation sprite) Sets the sprite of this move skill.void
toString()
void
unregister
(net.minecraft.server.level.ServerPlayer player) boolean
usePP()
Gets whether this move skill will consume PP or not.usePP
(boolean usePP) Sets whether this move skill should consume PP or not.void
writeAbleSpecs
(net.minecraft.network.FriendlyByteBuf buffer) void
writeAnyMoves
(net.minecraft.network.FriendlyByteBuf buffer) void
writeBehaviours
(net.minecraft.network.FriendlyByteBuf buffer) void
writeCombinationMoves
(net.minecraft.network.FriendlyByteBuf buffer) void
writeIntrinsicSpecs
(net.minecraft.network.FriendlyByteBuf buffer)
-
Constructor Details
-
MoveSkill
-
MoveSkill
-
-
Method Details
-
addMoveSkill
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
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
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
Performs the given consumer for each move skill present.- Parameters:
forEach
- The action to perform for each move skill.
-
isMoveSkill
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
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
Gets a new list containing all move skills.- Returns:
- A list of all move skills.
-
getMoveSkills
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
Gets the id of this move skill.- Returns:
- The id of this move skill.
-
name
Sets the name of this move skill.- Parameters:
name
- The new name of this move skill.- Returns:
- This move skill.
-
name
Gets the name of this move skill.- Returns:
- The name of this move skill.
-
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
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
Gets the description lines of this move skill.- Returns:
- The description lines of this move skill.
-
sprite
Sets the sprite of this move skill.- Parameters:
sprite
- The new sprite of this move skill.- Returns:
- This move skill.
-
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
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
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
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
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
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
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
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
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
Sets the set of specs which are able to use this move skill.- Parameters:
specs
- The specs to use.- Returns:
- This move skill.
-
addIntrinsicSpecs
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
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
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
-
applyCooldown
-
hasMoveSkill
-
hasTargetType
-
checkForPP
-
takePP
-
matchesIntrinsicSpecs
-
matchesAbleSpecs
-
matchesCombinationMoves
-
matchesAnyMoves
-
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
-
hashCode
public int hashCode() -
toString
-