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

    Constructors
    Constructor
    Description
    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
  • Method Summary

    Modifier and Type
    Method
    Description
    Optional<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 optional
    Optional<net.minecraft.core.BlockPos>
    If the target is a block it will obtain the position of said block Otherwise it will return an empty optional
    Optional<net.minecraft.world.entity.Entity>
    If the target is an entity it will obtain the hit entity Otherwise it will return an empty optional
    Gets the Poke Ball entity being thrown
    boolean
    Gets if the ball thrown was empty or not

    Methods inherited from class net.minecraftforge.eventbus.api.Event

    getListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 pokeball
      targetPosition - The target position
  • Method Details

    • getPokeBall

      public PokeBallEntity getPokeBall()
      Gets the Poke Ball entity being thrown
      Returns:
      The thrown Poke Ball
    • getEntityHit

      public Optional<net.minecraft.world.entity.Entity> 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

      public Optional<net.minecraft.core.BlockPos> 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

      public Optional<net.minecraft.world.level.block.state.BlockState> 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