Class LensUsedEvent

java.lang.Object
net.neoforged.bus.api.Event
com.pixelmonmod.pixelmon.api.events.LensUsedEvent
All Implemented Interfaces:
net.neoforged.bus.api.ICancellableEvent

public class LensUsedEvent extends net.neoforged.bus.api.Event implements net.neoforged.bus.api.ICancellableEvent
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
  • 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 java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.neoforged.bus.api.ICancellableEvent

    isCanceled
  • 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)
      Specified by:
      setCanceled in interface net.neoforged.bus.api.ICancellableEvent