Class HeldItemChangedEvent
java.lang.Object
net.minecraftforge.eventbus.api.Event
com.pixelmonmod.pixelmon.api.events.HeldItemChangedEvent
- Direct Known Subclasses:
HeldItemChangedEvent.Post
,HeldItemChangedEvent.Pre
public class HeldItemChangedEvent
extends net.minecraftforge.eventbus.api.Event
Event fired whenever a Pokémon's held item is changed. Use HeldItemChangedEvent.Pre or HeldItemChangedEvent.Post
As of the time of creation, this captures all Pixelmon-handled out-of-battle held item changes.
However, it is possible for sidemods to modify
the held item without triggering this event, and in-battle held item changes are ignored.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Event fired after a Pokémon's held item is changed.static class
Cancelable event fired before a Pokémon's held item is changed.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
Modifier and TypeFieldDescriptionprotected net.minecraft.world.item.ItemStack
The held item to use.protected final net.minecraft.server.level.ServerPlayer
The player owner of the Pokémon, if there is a player owner.protected final Pokemon
The Pokémon who is getting the new item. -
Constructor Summary
ModifierConstructorDescriptionprotected
HeldItemChangedEvent
(net.minecraft.server.level.ServerPlayer player, Pokemon pokemon, net.minecraft.world.item.ItemStack newHeldItem) -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.item.ItemStack
Gets theItemStack
of the held item that the Pokémon is getting.net.minecraft.server.level.ServerPlayer
Gets theServerPlayer
who is getting the new item.Gets thePokemon
who is getting the new item.Gets theSpecies
of the Pokémon who is getting the new item.Methods inherited from class net.minecraftforge.eventbus.api.Event
getListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult
-
Field Details
-
player
protected final net.minecraft.server.level.ServerPlayer playerThe player owner of the Pokémon, if there is a player owner. -
pokemon
The Pokémon who is getting the new item. -
heldItem
@Nonnull protected net.minecraft.world.item.ItemStack heldItemThe held item to use. This may be modified duringHeldItemChangedEvent.Pre
.
-
-
Constructor Details
-
HeldItemChangedEvent
protected HeldItemChangedEvent(@Nullable net.minecraft.server.level.ServerPlayer player, Pokemon pokemon, net.minecraft.world.item.ItemStack newHeldItem)
-
-
Method Details
-
getSpecies
Gets theSpecies
of the Pokémon who is getting the new item.- Returns:
- The Pokémon's species.
-
getPokemon
Gets thePokemon
who is getting the new item.- Returns:
- The Pokémon who is getting the new item.
-
getPlayer
public net.minecraft.server.level.ServerPlayer getPlayer()Gets theServerPlayer
who is getting the new item.- Returns:
- The player who is getting the new item
-
getHeldItem
@Nonnull public net.minecraft.world.item.ItemStack getHeldItem()Gets theItemStack
of the held item that the Pokémon is getting.- Returns:
- The held item that the Pokémon is getting.
-