aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/anthonyhilyard/iceberg/events/NewItemPickupEvent.java
blob: 8b583cb8e3fbb89914e402929dd21e98886370ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.anthonyhilyard.iceberg.events;

import net.minecraftforge.event.entity.player.PlayerEvent;

import java.util.UUID;

import net.minecraft.client.Minecraft;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.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}.
 */
@SuppressWarnings("null")
public class NewItemPickupEvent extends PlayerEvent
{
	private final ItemStack itemStack;

	public NewItemPickupEvent(Player 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;
	}
}