Class ItemEntityPickupEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.entity.player.ItemEntityPickupEvent
- Direct Known Subclasses:
ItemEntityPickupEvent.Post
,ItemEntityPickupEvent.Pre
public abstract class ItemEntityPickupEvent
extends net.neoforged.bus.api.Event
Parent class of the two events that fire when a
Player
collides with an ItemEntity
.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
This event is fired when anItemEntity
on the ground has been picked up by the player and after the item is added to the player's inventory.static class
This event is fired when a player collides with anItemEntity
on the ground. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionItemEntityPickupEvent
(net.minecraft.world.entity.player.Player player, net.minecraft.world.entity.item.ItemEntity item) -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.entity.item.ItemEntity
Returns theItemEntity
that was collided with.net.minecraft.world.entity.player.Player
Returns the player who collided with the item.
-
Field Details
-
player
private final net.minecraft.world.entity.player.Player player -
item
private final net.minecraft.world.entity.item.ItemEntity item
-
-
Constructor Details
-
ItemEntityPickupEvent
public ItemEntityPickupEvent(net.minecraft.world.entity.player.Player player, net.minecraft.world.entity.item.ItemEntity item)
-
-
Method Details
-
getPlayer
public net.minecraft.world.entity.player.Player getPlayer()Returns the player who collided with the item.- Returns:
- the player who collided with the item
-
getItemEntity
public net.minecraft.world.entity.item.ItemEntity getItemEntity()Returns theItemEntity
that was collided with.Changes to this item entity will impact further processing by the game and other event handlers.
Modification of the stored stack
ItemEntity.getItem()
is legal, but consumers of this event must not callItemEntity.setItem(ItemStack)
, as it will incur undefined behavior.
-