diff options
Diffstat (limited to 'src/main/java/com/anthonyhilyard/iceberg/events')
-rw-r--r-- | src/main/java/com/anthonyhilyard/iceberg/events/NewItemPickupEvent.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/main/java/com/anthonyhilyard/iceberg/events/NewItemPickupEvent.java b/src/main/java/com/anthonyhilyard/iceberg/events/NewItemPickupEvent.java new file mode 100644 index 0000000..a758769 --- /dev/null +++ b/src/main/java/com/anthonyhilyard/iceberg/events/NewItemPickupEvent.java @@ -0,0 +1,41 @@ +package com.anthonyhilyard.iceberg.events; + +import net.minecraftforge.event.entity.player.PlayerEvent; + +import java.util.UUID; + +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.MinecraftForge; + +/** + * This event is fired right before a player picks up a new item. Unlike EntityItemPickupEvent, this event fires on the logical client. + * <br> + * This event is not {@link net.minecraftforge.eventbus.api.Cancelable}.<br> + * <br> + * This event does not have a result. {@link HasResult}<br> + * <br> + * This event is fired on the {@link MinecraftForge#EVENT_BUS}. + */ +public class NewItemPickupEvent extends PlayerEvent +{ + private final ItemStack itemStack; + + public NewItemPickupEvent(PlayerEntity player, ItemStack itemStack) + { + super(player); + this.itemStack = itemStack; + } + + @SuppressWarnings("resource") + public NewItemPickupEvent(UUID playerUUID, ItemStack itemStack) + { + this(Minecraft.getInstance().level.getPlayerByUUID(playerUUID), itemStack); + } + + public ItemStack getItemStack() + { + return itemStack; + } +} |