diff options
author | Lorenz <ESs95s3P5z8Pheb> | 2022-07-14 12:06:07 +0200 |
---|---|---|
committer | Lorenz <ESs95s3P5z8Pheb> | 2022-07-14 12:06:07 +0200 |
commit | a5c540d977a3510812cac7fac340fe17e7d10983 (patch) | |
tree | dbbe5b208e6871378a10868d1206d1d78beeb950 /src/main/java/at/hannibal2/skyhanni/mixins/MixinGuiContainer.java | |
parent | d6c99ed30a2b1cb228b2fdc3d3178cf1f369dc53 (diff) | |
download | skyhanni-a5c540d977a3510812cac7fac340fe17e7d10983.tar.gz skyhanni-a5c540d977a3510812cac7fac340fe17e7d10983.tar.bz2 skyhanni-a5c540d977a3510812cac7fac340fe17e7d10983.zip |
renamed mod to SkyHanni
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/mixins/MixinGuiContainer.java')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/mixins/MixinGuiContainer.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/MixinGuiContainer.java b/src/main/java/at/hannibal2/skyhanni/mixins/MixinGuiContainer.java new file mode 100644 index 000000000..18997c33b --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/mixins/MixinGuiContainer.java @@ -0,0 +1,48 @@ +package at.hannibal2.skyhanni.mixins; + +import at.hannibal2.skyhanni.mixinhooks.GuiContainerHook; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.inventory.Slot; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(GuiContainer.class) +public abstract class MixinGuiContainer extends GuiScreen { + + @Unique + private final GuiContainerHook hook = new GuiContainerHook(this); + + @Inject(method = "keyTyped", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/entity/EntityPlayerSP;closeScreen()V", shift = At.Shift.BEFORE), cancellable = true) + private void closeWindowPressed(CallbackInfo ci) { + hook.closeWindowPressed(ci); + } + + @Inject(method = "drawScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GlStateManager;color(FFFF)V", ordinal = 1)) + private void backgroundDrawn(int mouseX, int mouseY, float partialTicks, CallbackInfo ci) { + hook.backgroundDrawn(mouseX, mouseY, partialTicks, ci); + } + + @Inject(method = "drawScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/inventory/GuiContainer;drawGuiContainerForegroundLayer(II)V", shift = At.Shift.AFTER)) + private void onForegroundDraw(int mouseX, int mouseY, float partialTicks, CallbackInfo ci) { + hook.foregroundDrawn(mouseX, mouseY, partialTicks, ci); + } + + @Inject(method = "drawSlot", at = @At("HEAD"), cancellable = true) + private void onDrawSlot(Slot slot, CallbackInfo ci) { + hook.onDrawSlot(slot, ci); + } + + @Inject(method = "drawSlot", at = @At("RETURN"), cancellable = true) + private void onDrawSlotPost(Slot slot, CallbackInfo ci) { + hook.onDrawSlotPost(slot, ci); + } + + @Inject(method = "handleMouseClick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/PlayerControllerMP;windowClick(IIIILnet/minecraft/entity/player/EntityPlayer;)Lnet/minecraft/item/ItemStack;"), cancellable = true) + private void onMouseClick(Slot slot, int slotId, int clickedButton, int clickType, CallbackInfo ci) { + hook.onMouseClick(slot, slotId, clickedButton, clickType, ci); + } +} |