aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/mixins
diff options
context:
space:
mode:
authorCalMWolfs <94038482+CalMWolfs@users.noreply.github.com>2024-05-30 18:01:24 +1000
committerGitHub <noreply@github.com>2024-05-30 10:01:24 +0200
commitb2733f13841363c9417c0eb79d7240990eb36bcb (patch)
tree4b407da2aac70e8976f1731186b9f99fcd18d248 /src/main/java/at/hannibal2/skyhanni/mixins
parent2fad00835fdb9d84a19c56c63a34c8a736a9aa5c (diff)
downloadskyhanni-b2733f13841363c9417c0eb79d7240990eb36bcb.tar.gz
skyhanni-b2733f13841363c9417c0eb79d7240990eb36bcb.tar.bz2
skyhanni-b2733f13841363c9417c0eb79d7240990eb36bcb.zip
Backend: Make skyhanni ReplaceItemEvent (#1866)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Co-authored-by: hannibal2 <24389977+hannibal002@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/mixins')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinInventoryBasic.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinInventoryBasic.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinInventoryBasic.java
new file mode 100644
index 000000000..7fdb2d604
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinInventoryBasic.java
@@ -0,0 +1,22 @@
+package at.hannibal2.skyhanni.mixins.transformers.gui;
+
+import at.hannibal2.skyhanni.events.render.gui.ReplaceItemEvent;
+import net.minecraft.inventory.InventoryBasic;
+import net.minecraft.item.ItemStack;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Shadow;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
+
+@Mixin(InventoryBasic.class)
+public class MixinInventoryBasic {
+
+ @Shadow
+ private ItemStack[] inventoryContents;
+
+ @Inject(method = "getStackInSlot", at = @At("HEAD"), cancellable = true)
+ public void getStackInSlot(int index, CallbackInfoReturnable<ItemStack> cir) {
+ ReplaceItemEvent.postEvent((InventoryBasic) (Object) this, this.inventoryContents, index, cir);
+ }
+}