aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickBrewing.kt27
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickEquipment.kt13
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickNPCSell.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt15
6 files changed, 51 insertions, 19 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index 2935c8222..bedfd4b33 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -209,6 +209,7 @@ import at.hannibal2.skyhanni.features.inventory.PowerStoneGuideFeatures
import at.hannibal2.skyhanni.features.inventory.QuickCraftFeatures
import at.hannibal2.skyhanni.features.inventory.RngMeterInventory
import at.hannibal2.skyhanni.features.inventory.SackDisplay
+import at.hannibal2.skyhanni.features.inventory.ShiftClickBrewing
import at.hannibal2.skyhanni.features.inventory.ShiftClickEquipment
import at.hannibal2.skyhanni.features.inventory.ShiftClickNPCSell
import at.hannibal2.skyhanni.features.inventory.SkyBlockLevelGuideHelper
@@ -478,6 +479,7 @@ class SkyHanniMod {
loadModule(TrophyFishFillet())
loadModule(TrophyFishMessages())
loadModule(BazaarBestSellMethod())
+ loadModule(ShiftClickBrewing())
loadModule(BazaarOpenPriceWebsite())
loadModule(AuctionHouseCopyUnderbidPrice())
loadModule(AnvilCombineHelper())
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java
index 0aed8ec3f..b01498728 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java
@@ -194,4 +194,10 @@ public class InventoryConfig {
@FeatureToggle
public boolean shiftClickNPCSell = false;
+ @Expose
+ @ConfigOption(name = "Shift Click Brewing", desc = "Makes normal clicks to shift clicks in Brewing Stand inventory.")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean shiftClickBrewing = false;
+
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickBrewing.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickBrewing.kt
new file mode 100644
index 000000000..0e7337bc0
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickBrewing.kt
@@ -0,0 +1,27 @@
+package at.hannibal2.skyhanni.features.inventory
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.events.GuiContainerEvent
+import at.hannibal2.skyhanni.utils.InventoryUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.makeShiftClick
+import net.minecraft.client.gui.inventory.GuiChest
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+class ShiftClickBrewing {
+
+ @SubscribeEvent
+ fun onSlotClick(event: GuiContainerEvent.SlotClickEvent) {
+ if (!LorenzUtils.inSkyBlock) return
+ if (!SkyHanniMod.feature.inventory.shiftClickBrewing) return
+
+ if (event.gui !is GuiChest) return
+
+ if (event.slot == null) return
+
+ val chestName = InventoryUtils.openInventoryName()
+ if (!chestName.startsWith("Brewing Stand")) return
+
+ event.makeShiftClick()
+ }
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickEquipment.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickEquipment.kt
index a472d4b90..4f9b08b20 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickEquipment.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickEquipment.kt
@@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod
import at.hannibal2.skyhanni.events.GuiContainerEvent
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.LorenzUtils
-import net.minecraft.client.Minecraft
+import at.hannibal2.skyhanni.utils.LorenzUtils.makeShiftClick
import net.minecraft.client.gui.inventory.GuiChest
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -26,13 +26,6 @@ class ShiftClickEquipment {
val chestName = InventoryUtils.openInventoryName()
if (!chestName.startsWith("Your Equipment")) return
- event.isCanceled = true
- Minecraft.getMinecraft().playerController.windowClick(
- event.container.windowId,
- event.slot.slotNumber,
- event.clickedButton,
- 1,
- Minecraft.getMinecraft().thePlayer
- )
+ event.makeShiftClick()
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickNPCSell.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickNPCSell.kt
index 9a18572b1..5e6c8bf6b 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickNPCSell.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ShiftClickNPCSell.kt
@@ -6,9 +6,9 @@ import at.hannibal2.skyhanni.events.InventoryCloseEvent
import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.makeShiftClick
import at.hannibal2.skyhanni.utils.StringUtils.matches
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
-import net.minecraft.client.Minecraft
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
object ShiftClickNPCSell {
@@ -46,9 +46,6 @@ object ShiftClickNPCSell {
if (slot.slotNumber == slot.slotIndex) return
- event.isCanceled = true
- Minecraft.getMinecraft().playerController.windowClick(
- event.container.windowId, event.slot.slotNumber, event.clickedButton, 1, Minecraft.getMinecraft().thePlayer
- )
+ event.makeShiftClick()
}
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
index 572aa147f..666ea54ea 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
@@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.data.HypixelData
import at.hannibal2.skyhanni.data.IslandType
import at.hannibal2.skyhanni.data.MayorElection
import at.hannibal2.skyhanni.data.TitleManager
+import at.hannibal2.skyhanni.events.GuiContainerEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.features.dungeon.DungeonAPI
import at.hannibal2.skyhanni.mixins.transformers.AccessorGuiEditSign
@@ -265,7 +266,7 @@ object LorenzUtils {
fun getSBMonthByName(month: String): Int {
var monthNr = 0
- for (i in 1 .. 12) {
+ for (i in 1..12) {
val monthName = SkyBlockTime.monthName(i)
if (month == monthName) {
monthNr = i
@@ -555,8 +556,8 @@ object LorenzUtils {
val tileSign = (this as AccessorGuiEditSign).tileSign
return (tileSign.signText[1].unformattedText.removeColor() == "^^^^^^"
- && tileSign.signText[2].unformattedText.removeColor() == "Set your"
- && tileSign.signText[3].unformattedText.removeColor() == "speed cap!")
+ && tileSign.signText[2].unformattedText.removeColor() == "Set your"
+ && tileSign.signText[3].unformattedText.removeColor() == "speed cap!")
}
fun IslandType.isInIsland() = inSkyBlock && skyBlockIsland == this
@@ -629,6 +630,13 @@ object LorenzUtils {
return this
}
+ fun GuiContainerEvent.SlotClickEvent.makeShiftClick() =
+ slot?.slotNumber?.let { slotNumber ->
+ Minecraft.getMinecraft().playerController.windowClick(
+ container.windowId, slotNumber, 0, 1, Minecraft.getMinecraft().thePlayer
+ )?.also { isCanceled = true }
+ }
+
fun <T> List<T>.indexOfFirst(vararg args: T) = args.map { indexOf(it) }.firstOrNull { it != -1 }
private val recalculateDerpy =
@@ -696,6 +704,5 @@ object LorenzUtils {
// Let garbage collector handle the removal of entries in this list
fun <T> weakReferenceList(): MutableSet<T> = Collections.newSetFromMap(WeakHashMap<T, Boolean>())
-
fun <T> MutableCollection<T>.filterToMutable(predicate: (T) -> Boolean) = filterTo(mutableListOf(), predicate)
}