From ac69a23dacfe35f7f24b8d3d86acd67133992ad0 Mon Sep 17 00:00:00 2001 From: Anthony Hilyard Date: Tue, 26 Oct 2021 12:15:56 -0700 Subject: Network protocol rewrite. Fixed final warning. Fixed gradient rect crash. --- .../iceberg/mixin/LivingEntityMixin.java | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/main/java/com/anthonyhilyard/iceberg/mixin/LivingEntityMixin.java (limited to 'src/main/java/com/anthonyhilyard/iceberg/mixin/LivingEntityMixin.java') 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()); + } + } +} -- cgit