Class BagItemEvent.SelectItem.Pre

Enclosing class:
BagItemEvent.SelectItem

public static class BagItemEvent.SelectItem.Pre extends BagItemEvent.SelectItem
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.
  • Constructor Details

    • Pre

      public Pre(BattleController battleController, String identifier, net.minecraft.server.level.ServerPlayer player, net.minecraft.world.item.ItemStack selectedItem, net.minecraft.world.item.ItemStack foundItem)
  • Method Details

    • setFoundItem

      public void setFoundItem(net.minecraft.world.item.ItemStack foundItem)
      Sets the ItemStack found by the item scan to something else. If a fake item was selected, then this must be set to a non-null value in order for the fake item to function.
      Parameters:
      foundItem - The ItemStack to be considered as found instead.