feat: wardrobe keybinds
This commit is contained in:
@@ -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)
|
||||
|
||||
58
src/main/kotlin/features/inventory/WardrobeKeybinds.kt
Normal file
58
src/main/kotlin/features/inventory/WardrobeKeybinds.kt
Normal file
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.",
|
||||
|
||||
Reference in New Issue
Block a user