aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/events/GuiContainerEvent.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/events/GuiContainerEvent.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/events/GuiContainerEvent.kt17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/events/GuiContainerEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/GuiContainerEvent.kt
index b11f75733..814f53d68 100644
--- a/src/main/java/at/hannibal2/skyhanni/events/GuiContainerEvent.kt
+++ b/src/main/java/at/hannibal2/skyhanni/events/GuiContainerEvent.kt
@@ -56,11 +56,13 @@ abstract class GuiContainerEvent(open val gui: GuiContainer, open val container:
val slot: Slot?,
val slotId: Int,
val clickedButton: Int,
+ @Deprecated("old", ReplaceWith("clickTypeEnum"))
val clickType: Int,
+ val clickTypeEnum: ClickType? = ClickType.getTypeById(clickType),
) : GuiContainerEvent(gui, container) {
fun makePickblock() {
- if (this.clickedButton == 2 && this.clickType == 3) return
+ if (this.clickedButton == 2 && this.clickTypeEnum == ClickType.HOTBAR) return
slot?.slotNumber?.let { slotNumber ->
Minecraft.getMinecraft().playerController.windowClick(
container.windowId, slotNumber, 2, 3, Minecraft.getMinecraft().thePlayer
@@ -69,4 +71,17 @@ abstract class GuiContainerEvent(open val gui: GuiContainer, open val container:
}
}
}
+
+ enum class ClickType(val id: Int) {
+ NORMAL(1),
+ SHIFT(2),
+ HOTBAR(3),
+ MIDDLE(4),
+ DROP(5),
+ ;
+
+ companion object {
+ fun getTypeById(id: Int) = entries.firstOrNull { it.id == id }
+ }
+ }
}