Class BagItemEvent.SelectItem
java.lang.Object
net.minecraftforge.eventbus.api.Event
com.pixelmonmod.pixelmon.api.events.battles.BattleEvent
com.pixelmonmod.pixelmon.api.events.battles.BagItemEvent
com.pixelmonmod.pixelmon.api.events.battles.BagItemEvent.SelectItem
- Direct Known Subclasses:
BagItemEvent.SelectItem.Post
,BagItemEvent.SelectItem.Pre
- Enclosing class:
- BagItemEvent
This event is fired when the client attempts to use an item from their bag, and it is subequently removed from their
inventory and then given to the battle controller.
This event is fired before the UseBattleItemEvent
and should be used to modify item removal if you've
added custom items to the list in the BagItemEvent.CollectItems.Pre
event
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
This event is fired after the updated item has been taken from their inventory and passed to the battle controllerstatic class
This is the event fired before the item is given to the battle controller & removed from the inventory Cancelling this event will create a waiting glitch for the client(s) in the battle so if you are cancelling it make sure to update the battle controller.Nested classes/interfaces inherited from class com.pixelmonmod.pixelmon.api.events.battles.BagItemEvent
BagItemEvent.CollectItems, BagItemEvent.Identifiers, BagItemEvent.SelectItem
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
protected final net.minecraft.world.item.ItemStack
Fields inherited from class com.pixelmonmod.pixelmon.api.events.battles.BattleEvent
battleController
-
Constructor Summary
ConstructorDescriptionSelectItem
(BattleController battleController, String identifier, net.minecraft.server.level.ServerPlayer player, net.minecraft.world.item.ItemStack selectedItem, net.minecraft.world.item.ItemStack foundItem) -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.item.ItemStack
TheItemStack
found by the inventory scan performed.net.minecraft.world.item.ItemStack
TheItemStack
selected by the player.Methods inherited from class com.pixelmonmod.pixelmon.api.events.battles.BagItemEvent
getIdentifier, getPlayer, isIdentifier, isNormalBattle
Methods inherited from class com.pixelmonmod.pixelmon.api.events.battles.BattleEvent
getBattleController
Methods inherited from class net.minecraftforge.eventbus.api.Event
getListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult
-
Field Details
-
selectedItem
protected final net.minecraft.world.item.ItemStack selectedItem -
foundItem
protected net.minecraft.world.item.ItemStack foundItem
-
-
Constructor Details
-
SelectItem
public SelectItem(BattleController battleController, String identifier, net.minecraft.server.level.ServerPlayer player, net.minecraft.world.item.ItemStack selectedItem, net.minecraft.world.item.ItemStack foundItem)
-
-
Method Details
-
getSelectedItem
public net.minecraft.world.item.ItemStack getSelectedItem()TheItemStack
selected by the player. This may not match the found item if a fake item was selected.- Returns:
- The
ItemStack
selected by the player.
-
getFoundItem
public net.minecraft.world.item.ItemStack getFoundItem()TheItemStack
found by the inventory scan performed. This may be null if a fake item was selected. In order for the item use to be successful, this must be set to a non-null value.- Returns:
- The
ItemStack
found by the inventory scan.
-