public interface CaptureMethod
Methods here are broken down to such a degree on purpose so that a new capture method doesn't need to implement
duplicate logic where it isn't necessary, and can instead just use the default implementations provided here, or
the implementation provided by another capture method, such as those in CaptureMethods
.
New capture methods can be registered for use in config and PokeBall
instances via CaptureMethodRegistry
.
Modifier and Type | Field and Description |
---|---|
static java.util.List<StatusType> |
MAJOR_STATUSES
List of major status effects for purposes of catch calculation.
|
static java.util.List<StatusType> |
MINOR_STATUSES
List of minor status effects for purposes of catch calculation.
|
Modifier and Type | Method and Description |
---|---|
default double |
calculateBallBonus(PokeBall pokeBall,
PokeBallEntity pokeBallEntity,
net.minecraft.entity.player.ServerPlayerEntity thrower,
Pokemon pokemon,
PokeBallMode mode)
Calculates the ball bonus for the
PokeBall being used. |
default CaptureValues |
calculateCapture(CaptureHealth health,
PokeBall pokeBall,
PokeBallEntity pokeBallEntity,
RaidData raid,
net.minecraft.entity.player.ServerPlayerEntity thrower,
Pokemon pokemon,
PokeBallMode mode)
The main method of capture calculations.
|
default int |
calculateCatchRate(PokeBall pokeBall,
PokeBallEntity pokeBallEntity,
net.minecraft.entity.player.ServerPlayerEntity thrower,
Pokemon pokemon,
PokeBallMode mode)
Calculates the catch rate of the
Pokemon being caught. |
default void |
captureCalculation(CaptureValues values,
CaptureHealth health,
PokeBall pokeBall,
PokeBallEntity pokeBallEntity,
net.minecraft.entity.player.ServerPlayerEntity thrower,
Pokemon pokemon,
PokeBallMode mode)
Performs the main capture calculation and sets the
CaptureValues accordingly. |
default CaptureValues |
constructValues(PokeBall pokeBall,
PokeBallEntity pokeBallEntity,
net.minecraft.entity.player.ServerPlayerEntity thrower,
Pokemon pokemon,
PokeBallMode mode)
Creates a new
CaptureValues to be used by the rest of the capture calculation. |
default void |
criticalCaptureCheck(CaptureValues values,
CaptureHealth health,
PokeBall pokeBall,
PokeBallEntity pokeBallEntity,
net.minecraft.entity.player.ServerPlayerEntity thrower,
Pokemon pokemon,
PokeBallMode mode)
Performs a critical capture check and sets the
CaptureValues accordingly. |
default boolean |
preCaptureChecks(CaptureValues values,
CaptureHealth health,
PokeBall pokeBall,
PokeBallEntity pokeBallEntity,
net.minecraft.entity.player.ServerPlayerEntity thrower,
Pokemon pokemon,
PokeBallMode mode)
Performs pre-capture checks for a regular capture attempt (not a raid).
|
default boolean |
preRaidCaptureChecks(CaptureValues values,
CaptureHealth health,
PokeBall pokeBall,
PokeBallEntity pokeBallEntity,
RaidData raid,
net.minecraft.entity.player.ServerPlayerEntity thrower,
Pokemon pokemon,
PokeBallMode mode)
Performs pre-capture checks for a raid capture attempt.
|
default void |
shakeCountCheck(CaptureValues values,
CaptureHealth health,
PokeBall pokeBall,
PokeBallEntity pokeBallEntity,
net.minecraft.entity.player.ServerPlayerEntity thrower,
Pokemon pokemon,
PokeBallMode mode)
Performs shake checks and sets the
CaptureValues accordingly. |
default double |
statusEffectCheck(CaptureValues values,
CaptureHealth health,
PokeBall pokeBall,
PokeBallEntity pokeBallEntity,
net.minecraft.entity.player.ServerPlayerEntity thrower,
Pokemon pokemon,
PokeBallMode mode)
Returns a value based on the current status effect of the
Pokemon being caught. |
CaptureValues |
tryCapture(CaptureValues values,
CaptureHealth health,
PokeBall pokeBall,
PokeBallEntity pokeBallEntity,
net.minecraft.entity.player.ServerPlayerEntity thrower,
Pokemon pokemon,
PokeBallMode mode)
Method that spins off into all the methods above.
|
static final java.util.List<StatusType> MAJOR_STATUSES
static final java.util.List<StatusType> MINOR_STATUSES
default CaptureValues calculateCapture(CaptureHealth health, PokeBall pokeBall, @Nullable PokeBallEntity pokeBallEntity, @Nullable RaidData raid, net.minecraft.entity.player.ServerPlayerEntity thrower, Pokemon pokemon, PokeBallMode mode)
health
- The CaptureHealth
for this capture attempt.pokeBall
- The PokeBall
being used in this capture attempt.pokeBallEntity
- The PokeBallEntity
being used for this capture attempt, if one exists.raid
- The RaidData
this capture attempt is part of, if one exists.thrower
- The player performing this capture attempt.pokemon
- The Pokemon
being caught.mode
- The PokeBallMode
of this capture attempt.CaptureValues
instance created by this capture attempt, with the results of this attempt contained within.default int calculateCatchRate(PokeBall pokeBall, @Nullable PokeBallEntity pokeBallEntity, net.minecraft.entity.player.ServerPlayerEntity thrower, Pokemon pokemon, PokeBallMode mode)
Pokemon
being caught. Generally, this would just want to be deferred to
the PokeBall
as this has its own logic for this, but this method allows this standard way to be changed
if required.pokeBall
- The PokeBall
being used in this capture attempt.pokeBallEntity
- The PokeBallEntity
being used for this capture attempt, if one exists.thrower
- The player performing this capture attempt.pokemon
- The Pokemon
being caught.mode
- The PokeBallMode
of this capture attempt.Pokemon
being caught.default double calculateBallBonus(PokeBall pokeBall, @Nullable PokeBallEntity pokeBallEntity, net.minecraft.entity.player.ServerPlayerEntity thrower, Pokemon pokemon, PokeBallMode mode)
PokeBall
being used. Generally, this would just want to be deferred to
the PokeBall
as this has its own logic for this, but this method allows this standard way to be changed
if required.pokeBall
- The PokeBall
being used in this capture attempt.pokeBallEntity
- The PokeBallEntity
being used for this capture attempt, if one exists.thrower
- The player performing this capture attempt.pokemon
- The Pokemon
being caught.mode
- The PokeBallMode
of this capture attempt.PokeBall
being used.default CaptureValues constructValues(PokeBall pokeBall, @Nullable PokeBallEntity pokeBallEntity, net.minecraft.entity.player.ServerPlayerEntity thrower, Pokemon pokemon, PokeBallMode mode)
CaptureValues
to be used by the rest of the capture calculation. By default, this is just
populated with the modified catch rate and ball bonus, but this method allows this logic to be changed if
required.pokeBall
- The PokeBall
being used in this capture attempt.pokeBallEntity
- The PokeBallEntity
being used for this capture attempt, if one exists.thrower
- The player performing this capture attempt.pokemon
- The Pokemon
being caught.mode
- The PokeBallMode
of this capture attempt.CaptureValues
of this capture attempt.default boolean preCaptureChecks(CaptureValues values, CaptureHealth health, PokeBall pokeBall, @Nullable PokeBallEntity pokeBallEntity, net.minecraft.entity.player.ServerPlayerEntity thrower, Pokemon pokemon, PokeBallMode mode)
values
- The CaptureValues
for this capture attempt.health
- The CaptureHealth
for this capture attempt.pokeBall
- The PokeBall
being used in this capture attempt.pokeBallEntity
- The PokeBallEntity
being used for this capture attempt, if one exists.thrower
- The player performing this capture attempt.pokemon
- The Pokemon
being caught.mode
- The PokeBallMode
of this capture attempt.CaptureValues
of this capture attempt.default boolean preRaidCaptureChecks(CaptureValues values, CaptureHealth health, PokeBall pokeBall, @Nullable PokeBallEntity pokeBallEntity, RaidData raid, net.minecraft.entity.player.ServerPlayerEntity thrower, Pokemon pokemon, PokeBallMode mode)
values
- The CaptureValues
for this capture attempt.health
- The CaptureHealth
for this capture attempt.pokeBall
- The PokeBall
being used in this capture attempt.pokeBallEntity
- The PokeBallEntity
being used for this capture attempt, if one exists.raid
- The RaidData
this capture attempt is part of.thrower
- The player performing this capture attempt.pokemon
- The Pokemon
being caught.mode
- The PokeBallMode
of this capture attempt.CaptureValues
of this capture attempt.default double statusEffectCheck(CaptureValues values, CaptureHealth health, PokeBall pokeBall, @Nullable PokeBallEntity pokeBallEntity, net.minecraft.entity.player.ServerPlayerEntity thrower, Pokemon pokemon, PokeBallMode mode)
Pokemon
being caught. This can then be used by
later steps of the capture calculation to modify what is required for that step.values
- The CaptureValues
for this capture attempt.health
- The CaptureHealth
for this capture attempt.pokeBall
- The PokeBall
being used in this capture attempt.pokeBallEntity
- The PokeBallEntity
being used for this capture attempt, if one exists.thrower
- The player performing this capture attempt.pokemon
- The Pokemon
being caught.mode
- The PokeBallMode
of this capture attempt.Pokemon
's current status effect.default void criticalCaptureCheck(CaptureValues values, CaptureHealth health, PokeBall pokeBall, @Nullable PokeBallEntity pokeBallEntity, net.minecraft.entity.player.ServerPlayerEntity thrower, Pokemon pokemon, PokeBallMode mode)
CaptureValues
accordingly. Not all capture calculations
will perform this check, so it may not necessarily be called for every capture.values
- The CaptureValues
for this capture attempt.health
- The CaptureHealth
for this capture attempt.pokeBall
- The PokeBall
being used in this capture attempt.pokeBallEntity
- The PokeBallEntity
being used for this capture attempt, if one exists.thrower
- The player performing this capture attempt.pokemon
- The Pokemon
being caught.mode
- The PokeBallMode
of this capture attempt.default void captureCalculation(CaptureValues values, CaptureHealth health, PokeBall pokeBall, @Nullable PokeBallEntity pokeBallEntity, net.minecraft.entity.player.ServerPlayerEntity thrower, Pokemon pokemon, PokeBallMode mode)
CaptureValues
accordingly. This method may not
necessarily set shake/capture values directly, as there is a later method that does this. Instead, this method
is intended to be used to create and set the variables needed in order to calculate the end result at that later
stage.values
- The CaptureValues
for this capture attempt.health
- The CaptureHealth
for this capture attempt.pokeBall
- The PokeBall
being used in this capture attempt.pokeBallEntity
- The PokeBallEntity
being used for this capture attempt, if one exists.thrower
- The player performing this capture attempt.pokemon
- The Pokemon
being caught.mode
- The PokeBallMode
of this capture attempt.default void shakeCountCheck(CaptureValues values, CaptureHealth health, PokeBall pokeBall, @Nullable PokeBallEntity pokeBallEntity, net.minecraft.entity.player.ServerPlayerEntity thrower, Pokemon pokemon, PokeBallMode mode)
CaptureValues
accordingly. This method is what ultimately will
decide if the current capture attempt succeeds or fails if it reaches this stage, and at the end of the method,
the CaptureValues
should be in its finalized state ready to be handed back to the initiator of this
capture attempt for processing. It is highly likely that variables set in captureCalculation(com.pixelmonmod.pixelmon.api.pokemon.catching.CaptureValues, com.pixelmonmod.pixelmon.api.pokemon.catching.CaptureHealth, com.pixelmonmod.pixelmon.api.pokemon.item.pokeball.PokeBall, com.pixelmonmod.pixelmon.entities.pokeballs.PokeBallEntity, net.minecraft.entity.player.ServerPlayerEntity, com.pixelmonmod.pixelmon.api.pokemon.Pokemon, com.pixelmonmod.pixelmon.entities.pokeballs.PokeBallMode)
will be used here in order to determine the number of shake checks that occur and if they pass or not.values
- The CaptureValues
for this capture attempt.health
- The CaptureHealth
for this capture attempt.pokeBall
- The PokeBall
being used in this capture attempt.pokeBallEntity
- The PokeBallEntity
being used for this capture attempt, if one exists.thrower
- The player performing this capture attempt.pokemon
- The Pokemon
being caught.mode
- The PokeBallMode
of this capture attempt.CaptureValues tryCapture(CaptureValues values, CaptureHealth health, PokeBall pokeBall, @Nullable PokeBallEntity pokeBallEntity, net.minecraft.entity.player.ServerPlayerEntity thrower, Pokemon pokemon, PokeBallMode mode)
CaptureValues
accordingly, otherwise will spin off into
preCaptureChecks(com.pixelmonmod.pixelmon.api.pokemon.catching.CaptureValues, com.pixelmonmod.pixelmon.api.pokemon.catching.CaptureHealth, com.pixelmonmod.pixelmon.api.pokemon.item.pokeball.PokeBall, com.pixelmonmod.pixelmon.entities.pokeballs.PokeBallEntity, net.minecraft.entity.player.ServerPlayerEntity, com.pixelmonmod.pixelmon.api.pokemon.Pokemon, com.pixelmonmod.pixelmon.entities.pokeballs.PokeBallMode)
followed by captureCalculation(com.pixelmonmod.pixelmon.api.pokemon.catching.CaptureValues, com.pixelmonmod.pixelmon.api.pokemon.catching.CaptureHealth, com.pixelmonmod.pixelmon.api.pokemon.item.pokeball.PokeBall, com.pixelmonmod.pixelmon.entities.pokeballs.PokeBallEntity, net.minecraft.entity.player.ServerPlayerEntity, com.pixelmonmod.pixelmon.api.pokemon.Pokemon, com.pixelmonmod.pixelmon.entities.pokeballs.PokeBallMode)
,
criticalCaptureCheck(com.pixelmonmod.pixelmon.api.pokemon.catching.CaptureValues, com.pixelmonmod.pixelmon.api.pokemon.catching.CaptureHealth, com.pixelmonmod.pixelmon.api.pokemon.item.pokeball.PokeBall, com.pixelmonmod.pixelmon.entities.pokeballs.PokeBallEntity, net.minecraft.entity.player.ServerPlayerEntity, com.pixelmonmod.pixelmon.api.pokemon.Pokemon, com.pixelmonmod.pixelmon.entities.pokeballs.PokeBallMode)
if applicable, and shakeCountCheck(com.pixelmonmod.pixelmon.api.pokemon.catching.CaptureValues, com.pixelmonmod.pixelmon.api.pokemon.catching.CaptureHealth, com.pixelmonmod.pixelmon.api.pokemon.item.pokeball.PokeBall, com.pixelmonmod.pixelmon.entities.pokeballs.PokeBallEntity, net.minecraft.entity.player.ServerPlayerEntity, com.pixelmonmod.pixelmon.api.pokemon.Pokemon, com.pixelmonmod.pixelmon.entities.pokeballs.PokeBallMode)
.values
- The CaptureValues
for this capture attempt.health
- The CaptureHealth
for this capture attempt.pokeBall
- The PokeBall
being used in this capture attempt.pokeBallEntity
- The PokeBallEntity
being used for this capture attempt, if one exists.thrower
- The player performing this capture attempt.pokemon
- The Pokemon
being caught.mode
- The PokeBallMode
of this capture attempt.