aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/mixins
diff options
context:
space:
mode:
authorThunderblade73 <85900443+Thunderblade73@users.noreply.github.com>2024-06-23 20:18:45 +0200
committerGitHub <noreply@github.com>2024-06-23 20:18:45 +0200
commit739a48d4679ce05c1f555a04fcdaa4e509d59d5d (patch)
treeb7b21a3548f441db11262f1e90267c9ec4666696 /src/main/java/at/hannibal2/skyhanni/mixins
parent6eb085f4e2ba69e98934ffa9489c8679ba23d244 (diff)
downloadskyhanni-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.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/transformers/gui/MixinGuiContainer.java5
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);