aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorThunderblade73 <85900443+Thunderblade73@users.noreply.github.com>2024-02-14 20:07:49 +0100
committerGitHub <noreply@github.com>2024-02-14 20:07:49 +0100
commitdf9f53b558999be18a80e500d26b62cbd26e5e28 (patch)
treed50c576b2a51ea48b13f2f46f06a7813fb445b75 /src/main/java/at/hannibal2
parentb015efd63855b3458aa0133f537efbcfedbe32f8 (diff)
downloadskyhanni-df9f53b558999be18a80e500d26b62cbd26e5e28.tar.gz
skyhanni-df9f53b558999be18a80e500d26b62cbd26e5e28.tar.bz2
skyhanni-df9f53b558999be18a80e500d26b62cbd26e5e28.zip
Ignore Shift Click NPC Sell when right-clicking a sack. #1005
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ItemCategory.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt1
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt5
4 files changed, 11 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemCategory.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemCategory.kt
index fa8003ca5..99407b3ed 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/ItemCategory.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemCategory.kt
@@ -45,6 +45,7 @@ enum class ItemCategory {
COSMETIC,
MEMENTO,
PORTAL,
+ SACK,
NONE,
;
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
index 0f506bacc..e44cccd9a 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
@@ -256,6 +256,7 @@ object ItemUtils {
isPet(cleanName) -> ItemCategory.PET
UtilsPatterns.enchantedBookPattern.matches(name) -> ItemCategory.ENCHANTED_BOOK
UtilsPatterns.potionPattern.matches(name) -> ItemCategory.POTION
+ UtilsPatterns.sackPattern.matches(name) -> ItemCategory.SACK
else -> ItemCategory.NONE
} else {
LorenzUtils.enumValueOfOrNull<ItemCategory>(itemCategory)
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
index d33fead7f..eafcc3fef 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
@@ -11,6 +11,7 @@ import at.hannibal2.skyhanni.mixins.transformers.AccessorGuiEditSign
import at.hannibal2.skyhanni.test.TestBingo
import at.hannibal2.skyhanni.utils.ChatUtils.lastButtonClicked
import at.hannibal2.skyhanni.utils.CollectionUtils.sortedDesc
+import at.hannibal2.skyhanni.utils.ItemUtils.getItemCategoryOrNull
import at.hannibal2.skyhanni.utils.NEUItems.getItemStackOrNull
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.StringUtils.capAtMinecraftLength
@@ -271,13 +272,15 @@ object LorenzUtils {
fun IslandType.isInIsland() = inSkyBlock && skyBlockIsland == this
- fun GuiContainerEvent.SlotClickEvent.makeShiftClick() =
+ fun GuiContainerEvent.SlotClickEvent.makeShiftClick() {
+ if (this.clickedButton == 1 && slot?.stack?.getItemCategoryOrNull() == ItemCategory.SACK) return
slot?.slotNumber?.let { slotNumber ->
Minecraft.getMinecraft().playerController.windowClick(
container.windowId, slotNumber, 0, 1, Minecraft.getMinecraft().thePlayer
)
isCanceled = true
}
+ }
private val recalculateDerpy =
RecalculatingValue(1.seconds) { MayorElection.isPerkActive("Derpy", "DOUBLE MOBS HP!!!") }
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt b/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt
index 014a1ad54..8f4d78239 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt
@@ -46,6 +46,11 @@ object UtilsPatterns {
"(?:§f§f)?§7\\[Lvl (?<level>\\d+)] .*"
)
+ val sackPattern by patternGroup.pattern(
+ "item.sack",
+ ".*Sack"
+ )
+
val seasonPattern by patternGroup.pattern(
"skyblocktime.season",
"(?:Early |Late )?(?<season>Spring|Summer|Autumn|Winter)"