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
FieldsModifier and TypeFieldDescriptionfinal RasLensItem
The specificRasLensItem
that the player is using.final PixelmonEntity
ThePixelmonEntity
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
TheItemStack
representing the lens. -
Constructor Summary
ConstructorsConstructorDescriptionLensUsedEvent
(net.minecraft.server.level.ServerPlayer player, PixelmonEntity pixelmon, net.minecraft.world.item.ItemStack stack) -
Method Summary
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 shouldItemBeDamagedWhether 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 playerThe player using the lens. -
pixelmon
ThePixelmonEntity
the lens is being used on. -
stack
public final net.minecraft.world.item.ItemStack stackTheItemStack
representing the lens. -
lens
The specificRasLensItem
that the player is using. This is easily derived fromstack
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 interfacenet.neoforged.bus.api.ICancellableEvent
-