Class PokeBallImpactEvent
java.lang.Object
net.minecraftforge.eventbus.api.Event
com.pixelmonmod.pixelmon.api.events.PokeBallImpactEvent
public class PokeBallImpactEvent
extends net.minecraftforge.eventbus.api.Event
This event is fired when a Poke Ball collides with something.
Cancelling the event will prevent any further actions to occur.
For example, if a player throws their Poke Ball at a pokemon and the event is cancelled then capture will not happen.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraftforge.eventbus.api.Event
net.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
-
Constructor Summary
ConstructorDescriptionPokeBallImpactEvent
(PokeBallEntity pokeBall, net.minecraft.world.phys.HitResult targetPosition) The basic constructor for the impact event taking the Poke Ball that is taking the collision and the ray traced block/entity that it has collided with -
Method Summary
Modifier and TypeMethodDescriptionOptional<net.minecraft.world.level.block.state.BlockState>
If the target is a block it will obtain the state of said block Otherwise it will return an empty optionalOptional<net.minecraft.core.BlockPos>
If the target is a block it will obtain the position of said block Otherwise it will return an empty optionalOptional<net.minecraft.world.entity.Entity>
If the target is an entity it will obtain the hit entity Otherwise it will return an empty optionalGets the Poke Ball entity being thrownboolean
Gets if the ball thrown was empty or notMethods inherited from class net.minecraftforge.eventbus.api.Event
getListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult
-
Constructor Details
-
PokeBallImpactEvent
public PokeBallImpactEvent(PokeBallEntity pokeBall, net.minecraft.world.phys.HitResult targetPosition) The basic constructor for the impact event taking the Poke Ball that is taking the collision and the ray traced block/entity that it has collided with- Parameters:
pokeBall
- The pokeballtargetPosition
- The target position
-
-
Method Details
-
getPokeBall
Gets the Poke Ball entity being thrown- Returns:
- The thrown Poke Ball
-
getEntityHit
If the target is an entity it will obtain the hit entity Otherwise it will return an empty optional- Returns:
- The target entity
-
getBlockPosHit
If the target is a block it will obtain the position of said block Otherwise it will return an empty optional- Returns:
- The target block position
-
getBlockHit
If the target is a block it will obtain the state of said block Otherwise it will return an empty optional- Returns:
- The target block state
-
isEmptyPokeBall
public boolean isEmptyPokeBall()Gets if the ball thrown was empty or not- Returns:
- Returns true if an empty poke ball
-