aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/anthonyhilyard/iceberg/mixin/LivingEntityMixin.java
diff options
context:
space:
mode:
authorAnthony Hilyard <anthony.hilyard@gmail.com>2021-10-26 12:15:56 -0700
committerAnthony Hilyard <anthony.hilyard@gmail.com>2021-10-26 12:15:56 -0700
commitac69a23dacfe35f7f24b8d3d86acd67133992ad0 (patch)
tree4a9ba157699763ac8b4deb9e4c6eac75aeb6fdc2 /src/main/java/com/anthonyhilyard/iceberg/mixin/LivingEntityMixin.java
parent730ec4f0faaf99e231279fdc026566f9970afb23 (diff)
downloadIceberg-ac69a23dacfe35f7f24b8d3d86acd67133992ad0.tar.gz
Iceberg-ac69a23dacfe35f7f24b8d3d86acd67133992ad0.tar.bz2
Iceberg-ac69a23dacfe35f7f24b8d3d86acd67133992ad0.zip
Network protocol rewrite. Fixed final warning. Fixed gradient rect
crash.
Diffstat (limited to 'src/main/java/com/anthonyhilyard/iceberg/mixin/LivingEntityMixin.java')
-rw-r--r--src/main/java/com/anthonyhilyard/iceberg/mixin/LivingEntityMixin.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/main/java/com/anthonyhilyard/iceberg/mixin/LivingEntityMixin.java b/src/main/java/com/anthonyhilyard/iceberg/mixin/LivingEntityMixin.java
new file mode 100644
index 0000000..d01df84
--- /dev/null
+++ b/src/main/java/com/anthonyhilyard/iceberg/mixin/LivingEntityMixin.java
@@ -0,0 +1,28 @@
+package com.anthonyhilyard.iceberg.mixin;
+
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+import net.minecraft.world.entity.LivingEntity;
+import net.minecraft.world.entity.item.ItemEntity;
+import net.minecraft.world.entity.player.Player;
+
+import com.anthonyhilyard.iceberg.Loader;
+import com.anthonyhilyard.iceberg.events.NewItemPickupCallback;
+
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+
+@Mixin(LivingEntity.class)
+public class LivingEntityMixin
+{
+ @Inject(method = { "onItemPickup" }, at = @At(value = "HEAD"))
+ private void onItemPickup(ItemEntity itemEntity, CallbackInfo info)
+ {
+ if ((LivingEntity)(Object)this instanceof Player)
+ {
+ Player player = (Player)(Object)this;
+ NewItemPickupCallback.EVENT.invoker().onItemPickup(player.getUUID(), itemEntity.getItem());
+ }
+ }
+}