aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/anthonyhilyard/iceberg/events
diff options
context:
space:
mode:
authorAnthony Hilyard <anthony.hilyard@gmail.com>2021-09-20 14:47:21 -0700
committerAnthony Hilyard <anthony.hilyard@gmail.com>2021-09-20 14:47:21 -0700
commit3d17eb42809b793e3684d089a3d2bbfd748422cf (patch)
tree712892544201ea9240e9d2650198b85db89bcaee /src/main/java/com/anthonyhilyard/iceberg/events
parentb8f63f66ddf9915bf8fc4f261339f603b2a63222 (diff)
downloadIceberg-3d17eb42809b793e3684d089a3d2bbfd748422cf.tar.gz
Iceberg-3d17eb42809b793e3684d089a3d2bbfd748422cf.tar.bz2
Iceberg-3d17eb42809b793e3684d089a3d2bbfd748422cf.zip
Updated tooltip handling, added remote pre-item pickup event and network
protocol.
Diffstat (limited to 'src/main/java/com/anthonyhilyard/iceberg/events')
-rw-r--r--src/main/java/com/anthonyhilyard/iceberg/events/NewItemPickupEvent.java41
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;
+ }
+}