Class BagItemEvent.SelectItem

java.lang.Object
net.minecraftforge.eventbus.api.Event
Direct Known Subclasses:
BagItemEvent.SelectItem.Post, BagItemEvent.SelectItem.Pre
Enclosing class:
BagItemEvent

public static class BagItemEvent.SelectItem extends 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

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    This event is fired after the updated item has been taken from their inventory and passed to the battle controller
    static 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

    Fields
    Modifier and Type
    Field
    Description
    protected 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

    Constructors
    Constructor
    Description
    SelectItem(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 Type
    Method
    Description
    net.minecraft.world.item.ItemStack
    The ItemStack found by the inventory scan performed.
    net.minecraft.world.item.ItemStack
    The ItemStack 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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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()
      The ItemStack 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()
      The ItemStack 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.