Class ItemEntityPickupEvent.Pre
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.entity.player.ItemEntityPickupEvent
net.neoforged.neoforge.event.entity.player.ItemEntityPickupEvent.Pre
- Enclosing class:
ItemEntityPickupEvent
This event is fired when a player collides with an
ItemEntity
on the ground.
It can be used to determine if the item may be picked up by the player.
If the pickup is successful (either by force or by default rules) ItemEntityPickupEvent.Post
will be fired.
This event is only fired on the logical server.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.neoforged.neoforge.event.entity.player.ItemEntityPickupEvent
ItemEntityPickupEvent.Post, ItemEntityPickupEvent.Pre
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPre
(net.minecraft.world.entity.player.Player player, net.minecraft.world.entity.item.ItemEntity item) -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.util.TriState
Returns the current pickup state.void
setCanPickup
(net.minecraft.util.TriState state) Changes if the player may pickup the item.Methods inherited from class net.neoforged.neoforge.event.entity.player.ItemEntityPickupEvent
getItemEntity, getPlayer
-
Field Details
-
canPickup
private net.minecraft.util.TriState canPickup
-
-
Constructor Details
-
Pre
public Pre(net.minecraft.world.entity.player.Player player, net.minecraft.world.entity.item.ItemEntity item)
-
-
Method Details
-
setCanPickup
public void setCanPickup(net.minecraft.util.TriState state) Changes if the player may pickup the item. SettingTriState.TRUE
orTriState.FALSE
will allow/deny the pickup respectively.The default rules require that
ItemEntity.pickupDelay
is zero, and thatItemEntity.target
matches (or is null).- Parameters:
state
- The new pickup state.
-
canPickup
public net.minecraft.util.TriState canPickup()Returns the current pickup state.- Returns:
- the current pickup state
- See Also:
-