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
Nested ClassesModifier and TypeClassDescriptionstatic classEvent fired after a Pokémon's held item is changed.static classCancelable 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
FieldsModifier and TypeFieldDescriptionprotected net.minecraft.world.item.ItemStackThe held item to use.protected final net.minecraft.server.level.ServerPlayerThe player owner of the Pokémon, if there is a player owner.protected final PokemonThe Pokémon who is getting the new item. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedHeldItemChangedEvent(net.minecraft.server.level.ServerPlayer player, Pokemon pokemon, net.minecraft.world.item.ItemStack newHeldItem) -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.item.ItemStackGets theItemStackof the held item that the Pokémon is getting.net.minecraft.server.level.ServerPlayerGets theServerPlayerwho is getting the new item.Gets thePokemonwho is getting the new item.Gets theSpeciesof 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 theSpeciesof the Pokémon who is getting the new item.- Returns:
- The Pokémon's species.
-
getPokemon
Gets thePokemonwho is getting the new item.- Returns:
- The Pokémon who is getting the new item.
-
getPlayer
public net.minecraft.server.level.ServerPlayer getPlayer()Gets theServerPlayerwho is getting the new item.- Returns:
- The player who is getting the new item
-
getHeldItem
@Nonnull public net.minecraft.world.item.ItemStack getHeldItem()Gets theItemStackof the held item that the Pokémon is getting.- Returns:
- The held item that the Pokémon is getting.
-