aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/features
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2025-09-06 00:44:10 +0200
committerLinnea Gräf <nea@nea.moe>2025-09-06 00:44:10 +0200
commit85b71d2a406c3c580dfd9af45ccfeef49b35581d (patch)
tree51361a98054c793a7d4bdd3a72636962b6fe8fe9 /src/main/kotlin/features
parentafc908fded2e35aad069cb1257072c263418f416 (diff)
downloadFirmament-85b71d2a406c3c580dfd9af45ccfeef49b35581d.tar.gz
Firmament-85b71d2a406c3c580dfd9af45ccfeef49b35581d.tar.bz2
Firmament-85b71d2a406c3c580dfd9af45ccfeef49b35581d.zip
feat: Allow blocking unequipping wardrobe with keybinds
Diffstat (limited to 'src/main/kotlin/features')
-rw-r--r--src/main/kotlin/features/FeatureManager.kt1
-rw-r--r--src/main/kotlin/features/inventory/WardrobeKeybinds.kt17
2 files changed, 7 insertions, 11 deletions
diff --git a/src/main/kotlin/features/FeatureManager.kt b/src/main/kotlin/features/FeatureManager.kt
index e0799c4..183365b 100644
--- a/src/main/kotlin/features/FeatureManager.kt
+++ b/src/main/kotlin/features/FeatureManager.kt
@@ -74,7 +74,6 @@ object FeatureManager : DataHolder<FeatureManager.Config>(serializer(), "feature
loadFeature(CustomCapes)
loadFeature(Hud)
loadFeature(EtherwarpOverlay)
- loadFeature(WardrobeKeybinds)
loadFeature(DianaWaypoints)
loadFeature(ItemRarityCosmetics)
loadFeature(PickaxeAbility)
diff --git a/src/main/kotlin/features/inventory/WardrobeKeybinds.kt b/src/main/kotlin/features/inventory/WardrobeKeybinds.kt
index 6e2b4a9..377afd3 100644
--- a/src/main/kotlin/features/inventory/WardrobeKeybinds.kt
+++ b/src/main/kotlin/features/inventory/WardrobeKeybinds.kt
@@ -9,11 +9,8 @@ import moe.nea.firmament.gui.config.ManagedConfig
import moe.nea.firmament.util.MC
import moe.nea.firmament.util.mc.SlotUtils.clickLeftMouseButton
-object WardrobeKeybinds : FirmamentFeature {
- override val identifier: String
- get() = "wardrobe-keybinds"
-
- object TConfig : ManagedConfig(identifier, Category.INVENTORY) {
+object WardrobeKeybinds {
+ object TConfig : ManagedConfig("wardrobe-keybinds", Category.INVENTORY) {
val wardrobeKeybinds by toggle("wardrobe-keybinds") { false }
val changePageKeybind by keyBinding("change-page") { GLFW.GLFW_KEY_ENTER }
val nextPage by keyBinding("next-page") { GLFW.GLFW_KEY_D }
@@ -21,11 +18,9 @@ object WardrobeKeybinds : FirmamentFeature {
val slotKeybinds = (1..9).map {
keyBinding("slot-$it") { GLFW.GLFW_KEY_0 + it }
}
+ val allowUnequipping by toggle("allow-unequipping") { true }
}
- override val config: ManagedConfig?
- get() = TConfig
-
val slotKeybindsWithSlot = TConfig.slotKeybinds.withIndex().map { (index, keybinding) ->
index + 36 to keybinding
}
@@ -60,7 +55,6 @@ object WardrobeKeybinds : FirmamentFeature {
}
-
val slot =
slotKeybindsWithSlot
.find { event.matches(it.second.get()) }
@@ -72,7 +66,10 @@ object WardrobeKeybinds : FirmamentFeature {
val invSlot = handler.getSlot(slot)
val itemStack = invSlot.stack
- if (itemStack.item != Items.PINK_DYE && itemStack.item != Items.LIME_DYE) return
+ val isSelected = itemStack.item == Items.LIME_DYE
+ val isSelectable = itemStack.item == Items.PINK_DYE
+ if (!isSelectable && !isSelected) return
+ if (!TConfig.allowUnequipping && isSelected) return
invSlot.clickLeftMouseButton(handler)
}