diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-09-28 21:59:37 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2022-09-28 21:59:37 +0200 |
commit | 03f30aa94951bef366985c1eddb72922c255b2b3 (patch) | |
tree | b5c31870d5da08161f079cd3ba5440fe79d5175b /src/main/java/at/hannibal2/skyhanni/mixins | |
parent | 613a8603d081589684c9f54133cae9b7a398c759 (diff) | |
download | skyhanni-03f30aa94951bef366985c1eddb72922c255b2b3.tar.gz skyhanni-03f30aa94951bef366985c1eddb72922c255b2b3.tar.bz2 skyhanni-03f30aa94951bef366985c1eddb72922c255b2b3.zip |
fixed stats tuning display
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/mixins')
3 files changed, 56 insertions, 23 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiContainerHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiContainerHook.kt index d4287f074..f8e0e225a 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiContainerHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiContainerHook.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.mixins.hooks +import at.hannibal2.skyhanni.events.DrawScreenAfterEvent import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.GuiContainerEvent.CloseWindowEvent import at.hannibal2.skyhanni.events.GuiContainerEvent.SlotClickEvent @@ -20,13 +21,7 @@ class GuiContainerHook(guiAny: Any) { } fun backgroundDrawn(mouseX: Int, mouseY: Int, partialTicks: Float, ci: CallbackInfo) { - GuiContainerEvent.BackgroundDrawnEvent( - gui, - gui.inventorySlots, - mouseX, - mouseY, - partialTicks - ).postAndCatch() + GuiContainerEvent.BackgroundDrawnEvent(gui, gui.inventorySlots, mouseX, mouseY, partialTicks).postAndCatch() } fun foregroundDrawn(mouseX: Int, mouseY: Int, partialTicks: Float, ci: CallbackInfo) { @@ -34,12 +29,7 @@ class GuiContainerHook(guiAny: Any) { } fun onDrawSlot(slot: Slot, ci: CallbackInfo) { - if (GuiContainerEvent.DrawSlotEvent.Pre( - gui, - gui.inventorySlots, - slot - ).postAndCatch() - ) ci.cancel() + if (GuiContainerEvent.DrawSlotEvent.Pre(gui, gui.inventorySlots, slot).postAndCatch()) ci.cancel() } fun onDrawSlotPost(slot: Slot, ci: CallbackInfo) { @@ -47,15 +37,14 @@ class GuiContainerHook(guiAny: Any) { } fun onMouseClick(slot: Slot?, slotId: Int, clickedButton: Int, clickType: Int, ci: CallbackInfo) { - if ( - SlotClickEvent( - gui, - gui.inventorySlots, - slot, - slotId, - clickedButton, - clickType - ).postAndCatch() - ) ci.cancel() + if (SlotClickEvent(gui, gui.inventorySlots, slot, slotId, clickedButton, clickType).postAndCatch()) ci.cancel() + } + + fun onDrawScreenAfter( + mouseX: Int, + mouseY: Int, + ci: CallbackInfo, + ) { + if (DrawScreenAfterEvent(mouseX, mouseY, ci).postAndCatch()) ci.cancel() } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/AccessorGuiContainer.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/AccessorGuiContainer.java new file mode 100644 index 000000000..e1e2c7c75 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/AccessorGuiContainer.java @@ -0,0 +1,33 @@ +package at.hannibal2.skyhanni.mixins.transformers.gui; + +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.inventory.Slot; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; +import org.spongepowered.asm.mixin.gen.Invoker; + +@Mixin(GuiContainer.class) +public interface AccessorGuiContainer { + + @Invoker("getSlotAtPosition") + Slot doGetSlotAtPosition(int x, int y); + + @Invoker("drawSlot") + void doDrawSlot(Slot slot); + + @Invoker("isMouseOverSlot") + boolean doIsMouseOverSlot(Slot slot, int x, int y); + + @Accessor("guiLeft") + int getGuiLeft(); + + @Accessor("guiTop") + int getGuiTop(); + + @Accessor("xSize") + int getXSize(); + + @Accessor("ySize") + int getYSize(); + +} diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiContainer.java b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiContainer.java index 3331c393f..a7fc852e5 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiContainer.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiContainer.java @@ -45,4 +45,15 @@ public abstract class MixinGuiContainer extends GuiScreen { private void onMouseClick(Slot slot, int slotId, int clickedButton, int clickType, CallbackInfo ci) { hook.onMouseClick(slot, slotId, clickedButton, clickType, ci); } + + @Inject(method = "drawScreen", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/client/renderer/GlStateManager;popMatrix()V", + shift = At.Shift.AFTER + ) + ) + public void drawScreen_after(int mouseX, int mouseY, float partialTicks, CallbackInfo ci) { + hook.onDrawScreenAfter(mouseX, mouseY, ci); + } } |