Class LensUsedEvent

java.lang.Object
net.minecraftforge.eventbus.api.Event
com.pixelmonmod.pixelmon.api.events.LensUsedEvent

public class LensUsedEvent extends net.minecraftforge.eventbus.api.Event
Event fired when someone uses one of Ras' lens on a Pokémon.

Cancelling this event will prevent the Pokémon from having its information revealed. By default, it will also prevent the item from being damaged by the use. This can be changed by setting shouldItemBeDamaged to false.

Created by Waterdude

Since:
January 17, 2022
  • 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
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The specific RasLensItem that the player is using.
    The PixelmonEntity the lens is being used on.
    final net.minecraft.server.level.ServerPlayer
    The player using the lens.
    boolean
    Whether or not the lens item should be damaged by this interaction, defaulting to true.
    final net.minecraft.world.item.ItemStack
    The ItemStack representing the lens.
  • Constructor Summary

    Constructors
    Constructor
    Description
    LensUsedEvent(net.minecraft.server.level.ServerPlayer player, PixelmonEntity pixelmon, net.minecraft.world.item.ItemStack stack)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    setCanceled(boolean cancelled)
     

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

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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • shouldItemBeDamaged

      public boolean shouldItemBeDamaged
      Whether or not the lens item should be damaged by this interaction, defaulting to true. If this event is cancelled, it will set this value to false.
    • player

      public final net.minecraft.server.level.ServerPlayer player
      The player using the lens.
    • pixelmon

      public final PixelmonEntity pixelmon
      The PixelmonEntity the lens is being used on.
    • stack

      public final net.minecraft.world.item.ItemStack stack
      The ItemStack representing the lens.
    • lens

      public final RasLensItem lens
      The specific RasLensItem that the player is using. This is easily derived from stack and is just for convenience.
  • Constructor Details

    • LensUsedEvent

      public LensUsedEvent(net.minecraft.server.level.ServerPlayer player, PixelmonEntity pixelmon, net.minecraft.world.item.ItemStack stack)
  • Method Details

    • setCanceled

      public void setCanceled(boolean cancelled)
      Overrides:
      setCanceled in class net.minecraftforge.eventbus.api.Event