diff options
author | Jacob <admin@kath.lol> | 2025-06-25 23:16:28 +0800 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2025-06-26 16:38:33 +0200 |
commit | e4490f23bd3091e147ddc4525ba1edb87ce41930 (patch) | |
tree | 87f3e4bf7b6db015bb3f502488281714b65b3ef7 | |
parent | 69124551ab0d8537d2abe542c100ac798b727ce6 (diff) | |
download | Firmament-e4490f23bd3091e147ddc4525ba1edb87ce41930.tar.gz Firmament-e4490f23bd3091e147ddc4525ba1edb87ce41930.tar.bz2 Firmament-e4490f23bd3091e147ddc4525ba1edb87ce41930.zip |
feat: wardrobe keybinds
-rw-r--r-- | src/main/kotlin/features/FeatureManager.kt | 2 | ||||
-rw-r--r-- | src/main/kotlin/features/inventory/WardrobeKeybinds.kt | 58 | ||||
-rw-r--r-- | translations/en_us.json | 21 |
3 files changed, 81 insertions, 0 deletions
diff --git a/src/main/kotlin/features/FeatureManager.kt b/src/main/kotlin/features/FeatureManager.kt index 87627b8..85a9784 100644 --- a/src/main/kotlin/features/FeatureManager.kt +++ b/src/main/kotlin/features/FeatureManager.kt @@ -25,6 +25,7 @@ import moe.nea.firmament.features.inventory.PetFeatures import moe.nea.firmament.features.inventory.PriceData import moe.nea.firmament.features.inventory.SaveCursorPosition import moe.nea.firmament.features.inventory.SlotLocking +import moe.nea.firmament.features.inventory.WardrobeKeybinds import moe.nea.firmament.features.inventory.buttons.InventoryButtons import moe.nea.firmament.features.inventory.storageoverlay.StorageOverlay import moe.nea.firmament.features.mining.PickaxeAbility @@ -69,6 +70,7 @@ object FeatureManager : DataHolder<FeatureManager.Config>(serializer(), "feature loadFeature(PriceData) loadFeature(Fixes) loadFeature(Hud) + 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 new file mode 100644 index 0000000..0dd3e97 --- /dev/null +++ b/src/main/kotlin/features/inventory/WardrobeKeybinds.kt @@ -0,0 +1,58 @@ +package moe.nea.firmament.features.inventory + +import org.lwjgl.glfw.GLFW +import net.minecraft.item.Items +import net.minecraft.screen.slot.SlotActionType +import moe.nea.firmament.annotations.Subscribe +import moe.nea.firmament.events.HandledScreenKeyPressedEvent +import moe.nea.firmament.features.FirmamentFeature +import moe.nea.firmament.gui.config.ManagedConfig +import moe.nea.firmament.util.MC + +object WardrobeKeybinds : FirmamentFeature { + override val identifier: String + get() = "wardrobe-keybinds" + + object TConfig : ManagedConfig(identifier, Category.INVENTORY) { + val wardrobeKeybinds by toggle("wardrobe-keybinds") { false } + val slot1 by keyBinding("slot-1") { GLFW.GLFW_KEY_1 } + val slot2 by keyBinding("slot-2") { GLFW.GLFW_KEY_2 } + val slot3 by keyBinding("slot-3") { GLFW.GLFW_KEY_3 } + val slot4 by keyBinding("slot-4") { GLFW.GLFW_KEY_4 } + val slot5 by keyBinding("slot-5") { GLFW.GLFW_KEY_5 } + val slot6 by keyBinding("slot-6") { GLFW.GLFW_KEY_6 } + val slot7 by keyBinding("slot-7") { GLFW.GLFW_KEY_7 } + val slot8 by keyBinding("slot-8") { GLFW.GLFW_KEY_8 } + val slot9 by keyBinding("slot-9") { GLFW.GLFW_KEY_9 } + } + + override val config: ManagedConfig? + get() = TConfig + + @Subscribe + fun switchSlot(it: HandledScreenKeyPressedEvent) { + if (MC.player == null || MC.world == null || MC.interactionManager == null) return + + val regex = Regex("Wardrobe \\([12]/2\\)") + if (!regex.matches(it.screen.title.string)) return + if (!TConfig.wardrobeKeybinds) return + + var slot: Int? = null + if (it.matches(TConfig.slot1)) slot = 36 + if (it.matches(TConfig.slot2)) slot = 37 + if (it.matches(TConfig.slot3)) slot = 38 + if (it.matches(TConfig.slot4)) slot = 39 + if (it.matches(TConfig.slot5)) slot = 40 + if (it.matches(TConfig.slot6)) slot = 41 + if (it.matches(TConfig.slot7)) slot = 42 + if (it.matches(TConfig.slot8)) slot = 43 + if (it.matches(TConfig.slot9)) slot = 44 + if (slot == null) return + + val itemStack = it.screen.getScreenHandler().getSlot(slot).stack + if (itemStack.item != Items.PINK_DYE && itemStack.item != Items.LIME_DYE) return + + MC.interactionManager!!.clickSlot(it.screen.getScreenHandler().syncId, slot, GLFW.GLFW_MOUSE_BUTTON_1, SlotActionType.PICKUP, MC.player); + } + +} diff --git a/translations/en_us.json b/translations/en_us.json index 0628915..1ef9a9b 100644 --- a/translations/en_us.json +++ b/translations/en_us.json @@ -331,6 +331,27 @@ "firmament.config.storage-overlay.rows.description": "Max columns used by the storage overlay and overview.", "firmament.config.storage-overlay.scroll-speed": "Scroll Speed", "firmament.config.storage-overlay.scroll-speed.description": "Scroll speed inside of the storage overlay and overview.", + "firmament.config.wardrobe-keybinds": "Wardrobe Keybinds", + "firmament.config.wardrobe-keybinds.slot-1": "Slot 1", + "firmament.config.wardrobe-keybinds.slot-1.description": "Keybind to toggle the first set in your wardrobe", + "firmament.config.wardrobe-keybinds.slot-2": "Slot 2", + "firmament.config.wardrobe-keybinds.slot-2.description": "Keybind to toggle the second set in your wardrobe", + "firmament.config.wardrobe-keybinds.slot-3": "Slot 3", + "firmament.config.wardrobe-keybinds.slot-3.description": "Keybind to toggle the third set in your wardrobe", + "firmament.config.wardrobe-keybinds.slot-4": "Slot 4", + "firmament.config.wardrobe-keybinds.slot-4.description": "Keybind to toggle the fourth set in your wardrobe", + "firmament.config.wardrobe-keybinds.slot-5": "Slot 5", + "firmament.config.wardrobe-keybinds.slot-5.description": "Keybind to toggle the fifth set in your wardrobe", + "firmament.config.wardrobe-keybinds.slot-6": "Slot 6", + "firmament.config.wardrobe-keybinds.slot-6.description": "Keybind to toggle the sixth set in your wardrobe", + "firmament.config.wardrobe-keybinds.slot-7": "Slot 7", + "firmament.config.wardrobe-keybinds.slot-7.description": "Keybind to toggle the seventh set in your wardrobe", + "firmament.config.wardrobe-keybinds.slot-8": "Slot 8", + "firmament.config.wardrobe-keybinds.slot-8.description": "Keybind to toggle the eighth set in your wardrobe", + "firmament.config.wardrobe-keybinds.slot-9": "Slot 9", + "firmament.config.wardrobe-keybinds.slot-9.description": "Keybind to toggle the ninth set in your wardrobe", + "firmament.config.wardrobe-keybinds.wardrobe-keybinds": "Keybinds for your wardrobe", + "firmament.config.wardrobe-keybinds.wardrobe-keybinds.description": "Lets you use your number keys to quickly change your wardrobe", "firmament.config.waypoints": "Waypoints", "firmament.config.waypoints.reset-order-on-swap": "Reset Ordered Waypoints On Hop", "firmament.config.waypoints.reset-order-on-swap.description": "Resets Ordered Waypoint progress after swapping to another world.", |