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
Nested Classes -
Constructor Summary
Constructors -
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 MoveSkilladdMoveSkill(MoveSkill skill) Inserts a given move skill into the map of available move skills.voidapplyCooldown(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.booleancheckForPP(Pokemon pokemon) static voidRemoves all move skills from the map of available move skills.intcooldown()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.booleanstatic voidforEachMoveSkill(Consumer<MoveSkill> forEach) Performs the given consumer for each move skill present.Gets a new list containing all move skills.static MoveSkillGets 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.inthashCode()booleanhasMoveSkill(Pokemon pokemon) booleanhasTargetType(MoveSkill.TargetType targetType) id()Gets the id of this move skill.static booleanisMoveSkill(String id) Checks whether the given id matches any move skill's id.booleanmatchesAbleSpecs(Pokemon pokemon) booleanmatchesAnyMoves(Pokemon pokemon) booleanmatchesCombinationMoves(Pokemon pokemon) booleanmatchesIntrinsicSpecs(Pokemon pokemon) name()Gets the name of this move skill.Sets the name of this move skill.voidonUsed(PixelmonEntity pixelmon, Object data, MoveSkill.TargetType targetType) intrange()Gets the range, in blocks, of this move skill.range(int range) Sets the range, in blocks, of this move skill.voidregister(net.minecraft.server.level.ServerPlayer player) static MoveSkillremoveMoveSkill(MoveSkill moveSkill) Removes a given move skill from the map of available move skills.static MoveSkillRemoves 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.ResourceLocationsprite()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.voidtoString()voidunregister(net.minecraft.server.level.ServerPlayer player) booleanusePP()Gets whether this move skill will consume PP or not.usePP(boolean usePP) Sets whether this move skill should consume PP or not.voidwriteAbleSpecs(net.minecraft.network.FriendlyByteBuf buffer) voidwriteAnyMoves(net.minecraft.network.FriendlyByteBuf buffer) voidwriteBehaviours(net.minecraft.network.FriendlyByteBuf buffer) voidwriteCombinationMoves(net.minecraft.network.FriendlyByteBuf buffer) voidwriteIntrinsicSpecs(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
-