diff options
author | Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> | 2024-06-23 20:18:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-23 20:18:45 +0200 |
commit | 739a48d4679ce05c1f555a04fcdaa4e509d59d5d (patch) | |
tree | b7b21a3548f441db11262f1e90267c9ec4666696 /src/main/java/at/hannibal2/skyhanni/mixins | |
parent | 6eb085f4e2ba69e98934ffa9489c8679ba23d244 (diff) | |
download | skyhanni-739a48d4679ce05c1f555a04fcdaa4e509d59d5d.tar.gz skyhanni-739a48d4679ce05c1f555a04fcdaa4e509d59d5d.tar.bz2 skyhanni-739a48d4679ce05c1f555a04fcdaa4e509d59d5d.zip |
Backend: Drag and Drop for Renderables (#1864)
Co-authored-by: Cal <cwolfson58@gmail.com>
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/mixins')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiContainerHook.kt | 7 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiContainer.java | 5 |
2 files changed, 11 insertions, 1 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 041457d25..552b16f00 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiContainerHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiContainerHook.kt @@ -36,7 +36,7 @@ class GuiContainerHook(guiAny: Any) { ci: CallbackInfo, ) { if (!SkyHanniDebugsAndTests.globalRender) return - if (GuiContainerEvent.BeforeDraw(gui, gui.inventorySlots, mouseX, mouseY, partialTicks).postAndCatch()) { + if (GuiContainerEvent.PreDraw(gui, gui.inventorySlots, mouseX, mouseY, partialTicks).postAndCatch()) { NEUApi.setInventoryButtonsToDisabled() GuiData.preDrawEventCancelled = true ci.cancel() @@ -47,6 +47,11 @@ class GuiContainerHook(guiAny: Any) { } } + fun postDraw(mouseX: Int, mouseY: Int, partialTicks: Float) { + if (!SkyHanniDebugsAndTests.globalRender) return + GuiContainerEvent.PostDraw(gui, gui.inventorySlots, mouseX, mouseY, partialTicks).postAndCatch() + } + fun foregroundDrawn(mouseX: Int, mouseY: Int, partialTicks: Float) { GuiContainerEvent.ForegroundDrawnEvent(gui, gui.inventorySlots, mouseX, mouseY, partialTicks).postAndCatch() } 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 c92f2ab7c..acec9ffac 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 @@ -36,6 +36,11 @@ public abstract class MixinGuiContainer extends GuiScreen { skyHanni$hook.preDraw(mouseX, mouseY, partialTicks, ci); } + @Inject(method = "drawScreen", at = @At("TAIL")) + private void postDraw(int mouseX, int mouseY, float partialTicks, CallbackInfo ci) { + skyHanni$hook.postDraw(mouseX, mouseY, partialTicks); + } + @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) { skyHanni$hook.foregroundDrawn(mouseX, mouseY, partialTicks); |