Class ItemTossEvent

java.lang.Object
net.neoforged.bus.api.Event
All Implemented Interfaces:
net.neoforged.bus.api.ICancellableEvent

public class ItemTossEvent extends ItemEvent implements net.neoforged.bus.api.ICancellableEvent
Event that is fired whenever a player tosses (Q) an item or drag-n-drops a stack of items outside the inventory GUI screens. Canceling the event will stop the items from entering the world, but will not prevent them being removed from the inventory - and thus removed from the system.
  • Nested Class Summary

    Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.EntityEvent

    EntityEvent.EnteringSection, EntityEvent.EntityConstructing, EntityEvent.Size
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final net.minecraft.world.entity.player.Player
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ItemTossEvent(net.minecraft.world.entity.item.ItemEntity entityItem, net.minecraft.world.entity.player.Player player)
    Creates a new event for EntityItems tossed by a player.
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.world.entity.player.Player
    The player tossing the item.

    Methods inherited from class net.neoforged.neoforge.event.entity.item.ItemEvent

    getEntity

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.neoforged.bus.api.ICancellableEvent

    isCanceled, setCanceled
  • Field Details

    • player

      private final net.minecraft.world.entity.player.Player player
  • Constructor Details

    • ItemTossEvent

      public ItemTossEvent(net.minecraft.world.entity.item.ItemEntity entityItem, net.minecraft.world.entity.player.Player player)
      Creates a new event for EntityItems tossed by a player.
      Parameters:
      entityItem - The EntityItem being tossed.
      player - The player tossing the item.
  • Method Details

    • getPlayer

      public net.minecraft.world.entity.player.Player getPlayer()
      The player tossing the item.