diff options
20 files changed, 438 insertions, 54 deletions
diff --git a/build.gradle.kts b/build.gradle.kts index 377cf07..3a72ed0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -126,6 +126,7 @@ fun innerJarsOf(name: String, dependency: Dependency): Provider<FileTree> { val collectTranslations by tasks.registering(CollectTranslations::class) { this.baseTranslations.from(file("translations/en_us.json")) + this.baseTranslations.from(file("translations/extra.json")) this.classes.from(sourceSets.main.get().kotlin.classesDirectory) } diff --git a/src/main/kotlin/features/inventory/buttons/InventoryButtons.kt b/src/main/kotlin/features/inventory/buttons/InventoryButtons.kt index 92640c8..361e8d0 100644 --- a/src/main/kotlin/features/inventory/buttons/InventoryButtons.kt +++ b/src/main/kotlin/features/inventory/buttons/InventoryButtons.kt @@ -5,16 +5,22 @@ package moe.nea.firmament.features.inventory.buttons import me.shedaniel.math.Rectangle import kotlinx.serialization.Serializable import kotlinx.serialization.serializer +import kotlin.time.Duration.Companion.seconds +import net.minecraft.client.MinecraftClient +import net.minecraft.text.Text import moe.nea.firmament.annotations.Subscribe import moe.nea.firmament.events.HandledScreenClickEvent import moe.nea.firmament.events.HandledScreenForegroundEvent import moe.nea.firmament.events.HandledScreenPushREIEvent import moe.nea.firmament.features.FirmamentFeature +import moe.nea.firmament.gui.FirmHoverComponent import moe.nea.firmament.gui.config.ManagedConfig import moe.nea.firmament.util.MC import moe.nea.firmament.util.ScreenUtil +import moe.nea.firmament.util.TimeMark import moe.nea.firmament.util.data.DataHolder import moe.nea.firmament.util.accessors.getRectangle +import moe.nea.firmament.util.gold object InventoryButtons : FirmamentFeature { override val identifier: String @@ -24,6 +30,7 @@ object InventoryButtons : FirmamentFeature { val _openEditor by button("open-editor") { openEditor() } + val hoverText by toggle("hover-text") { true } } object DConfig : DataHolder<Data>(serializer(), identifier, ::Data) @@ -60,16 +67,36 @@ object InventoryButtons : FirmamentFeature { } } + var lastHoveredComponent: InventoryButton? = null + var lastMouseMove = TimeMark.farPast() + @Subscribe fun onRenderForeground(it: HandledScreenForegroundEvent) { val bounds = it.screen.getRectangle() + + var hoveredComponent: InventoryButton? = null for (button in getValidButtons()) { val buttonBounds = button.getBounds(bounds) it.context.matrices.push() it.context.matrices.translate(buttonBounds.minX.toFloat(), buttonBounds.minY.toFloat(), 0F) button.render(it.context) it.context.matrices.pop() + + if (buttonBounds.contains(it.mouseX, it.mouseY) && TConfig.hoverText && hoveredComponent == null) { + hoveredComponent = button + if (lastMouseMove.passedTime() > 0.6.seconds && lastHoveredComponent === button) { + it.context.drawTooltip( + MC.font, + listOf(Text.literal(button.command).gold()), + buttonBounds.minX - 15, + buttonBounds.maxY + 20, + ) + } + } } + if (hoveredComponent !== lastHoveredComponent) + lastMouseMove = TimeMark.now() + lastHoveredComponent = hoveredComponent lastRectangle = bounds } diff --git a/src/main/kotlin/features/macros/ComboProcessor.kt b/src/main/kotlin/features/macros/ComboProcessor.kt index 55b3f6e..5c5ac0e 100644 --- a/src/main/kotlin/features/macros/ComboProcessor.kt +++ b/src/main/kotlin/features/macros/ComboProcessor.kt @@ -10,6 +10,7 @@ import moe.nea.firmament.events.WorldKeyboardEvent import moe.nea.firmament.keybindings.SavedKeyBinding import moe.nea.firmament.util.MC import moe.nea.firmament.util.TimeMark +import moe.nea.firmament.util.tr object ComboProcessor { @@ -22,18 +23,13 @@ object ComboProcessor { var isInputting = false var lastInput = TimeMark.farPast() val breadCrumbs = mutableListOf<SavedKeyBinding>() - // TODO: keep breadcrumbs - init { val f = SavedKeyBinding(InputUtil.GLFW_KEY_F) val one = SavedKeyBinding(InputUtil.GLFW_KEY_1) val two = SavedKeyBinding(InputUtil.GLFW_KEY_2) setActions( - listOf( - ComboKeyAction(CommandAction("wardrobe"), listOf(f, one)), - ComboKeyAction(CommandAction("equipment"), listOf(f, two)), - ) + MacroData.DConfig.data.comboActions ) } @@ -68,10 +64,24 @@ object ComboProcessor { 0F ) val breadCrumbText = breadCrumbs.joinToString(" > ") - event.context.drawText(MC.font, breadCrumbText, 0, 0, -1, true) + event.context.drawText( + MC.font, + tr("firmament.combo.active", "Current Combo: ").append(breadCrumbText), + 0, + 0, + -1, + true + ) event.context.matrices.translate(0F, MC.font.fontHeight + 2F, 0F) for ((key, value) in activeTrie.nodes) { - event.context.drawText(MC.font, Text.literal("$breadCrumbText > $key: ").append(value.label), 0, 0, -1, true) + event.context.drawText( + MC.font, + Text.literal("$breadCrumbText > $key: ").append(value.label), + 0, + 0, + -1, + true + ) event.context.matrices.translate(0F, MC.font.fontHeight + 1F, 0F) } event.context.matrices.pop() diff --git a/src/main/kotlin/features/macros/HotkeyAction.kt b/src/main/kotlin/features/macros/HotkeyAction.kt index 51c1baa..011f797 100644 --- a/src/main/kotlin/features/macros/HotkeyAction.kt +++ b/src/main/kotlin/features/macros/HotkeyAction.kt @@ -1,14 +1,19 @@ package moe.nea.firmament.features.macros +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable import net.minecraft.text.Text import moe.nea.firmament.util.MC -interface HotkeyAction { +@Serializable +sealed interface HotkeyAction { // TODO: execute val label: Text fun execute() } +@Serializable +@SerialName("command") data class CommandAction(val command: String) : HotkeyAction { override val label: Text get() = Text.literal("/$command") diff --git a/src/main/kotlin/features/macros/KeyComboTrie.kt b/src/main/kotlin/features/macros/KeyComboTrie.kt index 5c14bcd..57ff289 100644 --- a/src/main/kotlin/features/macros/KeyComboTrie.kt +++ b/src/main/kotlin/features/macros/KeyComboTrie.kt @@ -1,7 +1,9 @@ package moe.nea.firmament.features.macros +import kotlinx.serialization.Serializable import net.minecraft.text.Text import moe.nea.firmament.keybindings.SavedKeyBinding +import moe.nea.firmament.util.ErrorUtil sealed interface KeyComboTrie { val label: Text @@ -13,19 +15,27 @@ sealed interface KeyComboTrie { val root = Branch(mutableMapOf()) for (combo in combos) { var p = root - require(combo.keys.isNotEmpty()) + if (combo.keys.isEmpty()) { + ErrorUtil.softUserError("Key Combo for ${combo.action.label.string} is empty") + continue + } for ((index, key) in combo.keys.withIndex()) { val m = (p.nodes as MutableMap) if (index == combo.keys.lastIndex) { - if (key in m) - error("Overlapping actions found for ${combo.keys} (another action ${m[key]} already exists).") + if (key in m) { + ErrorUtil.softUserError("Overlapping actions found for ${combo.keys.joinToString(" > ")} (another action ${m[key]} already exists).") + break + } m[key] = Leaf(combo.action) } else { val c = m.getOrPut(key) { Branch(mutableMapOf()) } - if (c !is Branch) - error("Overlapping actions found for ${combo.keys} (final node exists at index $index) through another action already") - p = c + if (c !is Branch) { + ErrorUtil.softUserError("Overlapping actions found for ${combo.keys} (final node exists at index $index) through another action already") + break + } else { + p = c + } } } } @@ -35,6 +45,7 @@ sealed interface KeyComboTrie { } +@Serializable data class ComboKeyAction( val action: HotkeyAction, val keys: List<SavedKeyBinding>, diff --git a/src/main/kotlin/features/macros/MacroData.kt b/src/main/kotlin/features/macros/MacroData.kt new file mode 100644 index 0000000..78a5948 --- /dev/null +++ b/src/main/kotlin/features/macros/MacroData.kt @@ -0,0 +1,11 @@ +package moe.nea.firmament.features.macros + +import kotlinx.serialization.Serializable +import moe.nea.firmament.util.data.DataHolder + +@Serializable +data class MacroData( + var comboActions: List<ComboKeyAction> = listOf(), +){ + object DConfig : DataHolder<MacroData>(kotlinx.serialization.serializer(), "macros", ::MacroData) +} diff --git a/src/main/kotlin/features/macros/MacroUI.kt b/src/main/kotlin/features/macros/MacroUI.kt new file mode 100644 index 0000000..17fdd0a --- /dev/null +++ b/src/main/kotlin/features/macros/MacroUI.kt @@ -0,0 +1,161 @@ +package moe.nea.firmament.features.macros + +import io.github.notenoughupdates.moulconfig.gui.CloseEventListener +import io.github.notenoughupdates.moulconfig.observer.ObservableList +import io.github.notenoughupdates.moulconfig.xml.Bind +import moe.nea.firmament.annotations.Subscribe +import moe.nea.firmament.commands.thenExecute +import moe.nea.firmament.events.CommandEvent +import moe.nea.firmament.gui.config.AllConfigsGui.toObservableList +import moe.nea.firmament.gui.config.KeyBindingStateManager +import moe.nea.firmament.keybindings.SavedKeyBinding +import moe.nea.firmament.util.MC +import moe.nea.firmament.util.MoulConfigUtils +import moe.nea.firmament.util.ScreenUtil + +class MacroUI { + + + companion object { + @Subscribe + fun onCommands(event: CommandEvent.SubCommand) { + // TODO: add button in config + event.subcommand("macros") { + thenExecute { + ScreenUtil.setScreenLater(MoulConfigUtils.loadScreen("config/macros/index", MacroUI(), null)) + } + } + } + + } + + @field:Bind("combos") + val combos = Combos() + + class Combos { + @field:Bind("actions") + val actions: ObservableList<ActionEditor> = ObservableList( + MacroData.DConfig.data.comboActions.mapTo(mutableListOf()) { + ActionEditor(it, this) + } + ) + + var dontSave = false + + @Bind + fun beforeClose(): CloseEventListener.CloseAction { + if (!dontSave) + save() + return CloseEventListener.CloseAction.NO_OBJECTIONS_TO_CLOSE + } + + @Bind + fun addCommand() { + actions.add( + ActionEditor( + ComboKeyAction( + CommandAction("ac Hello from a Firmament Hotkey"), + listOf() + ), + this + ) + ) + } + + @Bind + fun discard() { + dontSave = true + MC.screen?.close() + } + + @Bind + fun saveAndClose() { + save() + MC.screen?.close() + } + + @Bind + fun save() { + MacroData.DConfig.data.comboActions = actions.map { it.asSaveable() } + MacroData.DConfig.markDirty() + ComboProcessor.setActions(MacroData.DConfig.data.comboActions) // TODO: automatically reload those from the config on startup + } + } + + class KeyBindingEditor(var binding: SavedKeyBinding, val parent: ActionEditor) { + val sm = KeyBindingStateManager( + { binding }, + { binding = it }, + ::blur, + ::requestFocus + ) + + @field:Bind + val button = sm.createButton() + + init { + sm.updateLabel() + } + + fun blur() { + button.blur() + } + + @Bind + fun delete() { + parent.combo.removeIf { it === this } + parent.combo.update() + } + + fun requestFocus() { + button.requestFocus() + } + } + + class ActionEditor(val action: ComboKeyAction, val parent: MacroUI.Combos) { + fun asSaveable(): ComboKeyAction { + return ComboKeyAction( + CommandAction(command), + combo.map { it.binding } + ) + } + + @field:Bind("command") + var command: String = (action.action as CommandAction).command + + @field:Bind("combo") + val combo = action.keys.map { KeyBindingEditor(it, this) }.toObservableList() + + @Bind + fun formattedCombo() = + combo.joinToString(" > ") { it.binding.toString() } + + @Bind + fun addStep() { + combo.add(KeyBindingEditor(SavedKeyBinding.unbound(), this)) + } + + @Bind + fun back() { + MC.screen?.close() + } + + @Bind + fun delete() { + parent.actions.removeIf { it === this } + parent.actions.update() + } + @Bind + fun edit() { + MC.screen = MoulConfigUtils.loadScreen("config/macros/editor", this, MC.screen) + } + } +} + +private fun <T> ObservableList<T>.setAll(ts: Collection<T>) { + val observer = this.observer + this.clear() + this.addAll(ts) + this.observer = observer + this.update() +} diff --git a/src/main/kotlin/gui/config/KeyBindingHandler.kt b/src/main/kotlin/gui/config/KeyBindingHandler.kt index d7d0b47..14a4b32 100644 --- a/src/main/kotlin/gui/config/KeyBindingHandler.kt +++ b/src/main/kotlin/gui/config/KeyBindingHandler.kt @@ -40,34 +40,7 @@ class KeyBindingHandler(val name: String, val managedConfig: ManagedConfig) : { button.blur() }, { button.requestFocus() } ) - button = object : FirmButtonComponent( - TextComponent( - IMinecraft.instance.defaultFontRenderer, - { sm.label.string }, - 130, - TextComponent.TextAlignment.LEFT, - false, - false - ), action = { - sm.onClick() - }) { - override fun keyboardEvent(event: KeyboardEvent, context: GuiImmediateContext): Boolean { - if (event is KeyboardEvent.KeyPressed) { - return sm.keyboardEvent(event.keycode, event.pressed) - } - return super.keyboardEvent(event, context) - } - - override fun getBackground(context: GuiImmediateContext): NinePatch<MyResourceLocation> { - if (sm.editing) return activeBg - return super.getBackground(context) - } - - - override fun onLostFocus() { - sm.onLostFocus() - } - } + button = sm.createButton() sm.updateLabel() return button } diff --git a/src/main/kotlin/gui/config/KeyBindingStateManager.kt b/src/main/kotlin/gui/config/KeyBindingStateManager.kt index cc8178d..1528ac4 100644 --- a/src/main/kotlin/gui/config/KeyBindingStateManager.kt +++ b/src/main/kotlin/gui/config/KeyBindingStateManager.kt @@ -1,8 +1,15 @@ package moe.nea.firmament.gui.config +import io.github.notenoughupdates.moulconfig.common.IMinecraft +import io.github.notenoughupdates.moulconfig.common.MyResourceLocation +import io.github.notenoughupdates.moulconfig.deps.libninepatch.NinePatch +import io.github.notenoughupdates.moulconfig.gui.GuiImmediateContext +import io.github.notenoughupdates.moulconfig.gui.KeyboardEvent +import io.github.notenoughupdates.moulconfig.gui.component.TextComponent import org.lwjgl.glfw.GLFW import net.minecraft.text.Text import net.minecraft.util.Formatting +import moe.nea.firmament.gui.FirmButtonComponent import moe.nea.firmament.keybindings.SavedKeyBinding class KeyBindingStateManager( @@ -51,9 +58,11 @@ class KeyBindingStateManager( ) { lastPressed = ch } else { - setValue(SavedKeyBinding( - ch, modifiers - )) + setValue( + SavedKeyBinding( + ch, modifiers + ) + ) editing = false blur() lastPressed = 0 @@ -104,5 +113,34 @@ class KeyBindingStateManager( label = stroke } + fun createButton(): FirmButtonComponent { + return object : FirmButtonComponent( + TextComponent( + IMinecraft.instance.defaultFontRenderer, + { this@KeyBindingStateManager.label.string }, + 130, + TextComponent.TextAlignment.LEFT, + false, + false + ), action = { + this@KeyBindingStateManager.onClick() + }) { + override fun keyboardEvent(event: KeyboardEvent, context: GuiImmediateContext): Boolean { + if (event is KeyboardEvent.KeyPressed) { + return this@KeyBindingStateManager.keyboardEvent(event.keycode, event.pressed) + } + return super.keyboardEvent(event, context) + } + + override fun getBackground(context: GuiImmediateContext): NinePatch<MyResourceLocation> { + if (this@KeyBindingStateManager.editing) return activeBg + return super.getBackground(context) + } + + override fun onLostFocus() { + this@KeyBindingStateManager.onLostFocus() + } + } + } } diff --git a/src/main/kotlin/keybindings/SavedKeyBinding.kt b/src/main/kotlin/keybindings/SavedKeyBinding.kt index 5429844..d85c303 100644 --- a/src/main/kotlin/keybindings/SavedKeyBinding.kt +++ b/src/main/kotlin/keybindings/SavedKeyBinding.kt @@ -57,7 +57,9 @@ data class SavedKeyBinding( fun isShiftDown() = InputUtil.isKeyPressed(h, GLFW.GLFW_KEY_LEFT_SHIFT) || InputUtil.isKeyPressed(h, GLFW.GLFW_KEY_RIGHT_SHIFT) - } + fun unbound(): SavedKeyBinding = + SavedKeyBinding(GLFW.GLFW_KEY_UNKNOWN) + } fun isPressed(atLeast: Boolean = false): Boolean { if (!isBound) return false diff --git a/src/main/kotlin/util/ErrorUtil.kt b/src/main/kotlin/util/ErrorUtil.kt index af36d81..e82d369 100644 --- a/src/main/kotlin/util/ErrorUtil.kt +++ b/src/main/kotlin/util/ErrorUtil.kt @@ -75,4 +75,7 @@ object ErrorUtil { return nullable } + fun softUserError(string: String) { + MC.sendChat(tr("frimanet.usererror", "Firmament encountered a user caused error: $string")) + } } diff --git a/src/main/kotlin/util/MC.kt b/src/main/kotlin/util/MC.kt index d8a3ab1..e85b119 100644 --- a/src/main/kotlin/util/MC.kt +++ b/src/main/kotlin/util/MC.kt @@ -1,6 +1,7 @@ package moe.nea.firmament.util import io.github.moulberry.repo.data.Coordinate +import io.github.notenoughupdates.moulconfig.gui.GuiComponentWrapper import java.util.concurrent.ConcurrentLinkedQueue import kotlin.jvm.optionals.getOrNull import net.minecraft.client.MinecraftClient @@ -126,6 +127,8 @@ object MC { } private set + val currentMoulConfigContext + get() = (screen as? GuiComponentWrapper)?.context fun openUrl(uri: String) { Util.getOperatingSystem().open(uri) diff --git a/src/main/kotlin/util/SkyblockId.kt b/src/main/kotlin/util/SkyblockId.kt index 5613393..7d8c96c 100644 --- a/src/main/kotlin/util/SkyblockId.kt +++ b/src/main/kotlin/util/SkyblockId.kt @@ -6,7 +6,8 @@ import com.mojang.serialization.Codec import io.github.moulberry.repo.data.NEUIngredient import io.github.moulberry.repo.data.NEUItem import io.github.moulberry.repo.data.Rarity -import java.util.* +import java.util.Optional +import java.util.UUID import kotlinx.serialization.Serializable import kotlinx.serialization.UseSerializers import kotlinx.serialization.json.Json @@ -28,8 +29,8 @@ import moe.nea.firmament.util.json.DashlessUUIDSerializer /** * A SkyBlock item id, as used by the NEU repo. - * This is not exactly the format used by HyPixel, but is mostly the same. - * Usually this id splits an id used by HyPixel into more sub items. For example `PET` becomes `$PET_ID;$PET_RARITY`, + * This is not exactly the format used by Hypixel, but is mostly the same. + * Usually this id splits an id used by Hypixel into more sub items. For example `PET` becomes `$PET_ID;$PET_RARITY`, * with those values extracted from other metadata. */ @JvmInline @@ -53,7 +54,7 @@ value class SkyblockId(val neuItem: String) : Comparable<SkyblockId> { } /** - * A bazaar stock item id, as returned by the HyPixel bazaar api endpoint. + * A bazaar stock item id, as returned by the Hypixel bazaar api endpoint. * These are not equivalent to the in-game ids, or the NEU repo ids, and in fact, do not refer to items, but instead * to bazaar stocks. The main difference from [SkyblockId]s is concerning enchanted books. There are probably more, * but for now this holds. @@ -220,12 +221,26 @@ val ItemStack.skyBlockId: SkyblockId? when { potionName != null -> SkyblockId("POTION_${potionName.uppercase()};$potionLevel") potionData != null -> SkyblockId("POTION_${potionData.uppercase()};$potionLevel") - potionType != null -> SkyblockId("POTION${potionType.uppercase()}") + potionType != null -> SkyblockId("POTION_${potionType.uppercase()}") else -> SkyblockId("WATER_BOTTLE") } } - // TODO: PARTY_HAT_CRAB{,_ANIMATED,_SLOTH} + "PARTY_HAT_SLOTH", "PARTY_HAT_CRAB", "PARTY_HAT_CRAB_ANIMATED" -> { + val partyHatEmoji = extraAttributes.getString("party_hat_emoji").getOrNull() + val partyHatYear = extraAttributes.getInt("party_hat_year").getOrNull() + val partyHatColor = extraAttributes.getString("party_hat_color").getOrNull() + when { + partyHatEmoji != null -> SkyblockId("PARTY_HAT_SLOTH_${partyHatEmoji.uppercase()}") + partyHatYear == 2022 -> SkyblockId("PARTY_HAT_CRAB_${partyHatColor?.uppercase()}_ANIMATED") + else -> SkyblockId("PARTY_HAT_CRAB_${partyHatColor?.uppercase()}") + } + } + + "BALLOON_HAT_2024" -> { + SkyblockId("BALLOON_HAT_2024_${extraAttributes.getString("party_hat_color").getOrNull()?.uppercase()}") + } + else -> { SkyblockId(id) } diff --git a/src/main/kotlin/util/TestUtil.kt b/src/main/kotlin/util/TestUtil.kt index 45e3dde..da8ba38 100644 --- a/src/main/kotlin/util/TestUtil.kt +++ b/src/main/kotlin/util/TestUtil.kt @@ -2,6 +2,7 @@ package moe.nea.firmament.util object TestUtil { inline fun <T> unlessTesting(block: () -> T): T? = if (isInTest) null else block() + @JvmField val isInTest = Thread.currentThread().stackTrace.any { it.className.startsWith("org.junit.") || it.className.startsWith("io.kotest.") diff --git a/src/main/resources/assets/firmament/gui/config/macros/combos.xml b/src/main/resources/assets/firmament/gui/config/macros/combos.xml new file mode 100644 index 0000000..b2865ab --- /dev/null +++ b/src/main/resources/assets/firmament/gui/config/macros/combos.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<Root xmlns="http://notenoughupdates.org/moulconfig" xmlns:firm="http://firmament.nea.moe/moulconfig" +> + <Panel background="TRANSPARENT" insets="10"> + <Column> + <Meta beforeClose="@beforeClose"/> + <ScrollPanel width="380" height="300"> + <Align horizontal="CENTER"> + <Array data="@actions"> + <!-- evenBackground="#8B8B8B" oddBackground="#C6C6C6" --> + <Panel background="TRANSPARENT" insets="3"> + <Panel background="VANILLA" insets="6"> + <Column> + <Row> + <Text text="@command" width="280"/> + </Row> + <Row> + <Text text="@formattedCombo" width="250"/> + <Align horizontal="RIGHT"> + <Row> + <firm:Button onClick="@edit"> + <Text text="Edit"/> + </firm:Button> + <Spacer width="12"/> + <firm:Button onClick="@delete"> + <Text text="Delete"/> + </firm:Button> + </Row> + </Align> + </Row> + </Column> + </Panel> + + </Panel> + </Array> + </Align> + </ScrollPanel> + <Align horizontal="RIGHT"> + <Row> + <firm:Button onClick="@discard"> + <Text text="Discard Changes"/> + </firm:Button> + <firm:Button onClick="@saveAndClose"> + <Text text="Save & Close"/> + </firm:Button> + <firm:Button onClick="@save"> + <Text text="Save"/> + </firm:Button> + <firm:Button onClick="@addCommand"> + <Text text="Add Combo Command"/> + </firm:Button> + </Row> + </Align> + </Column> + </Panel> +</Root> diff --git a/src/main/resources/assets/firmament/gui/config/macros/editor.xml b/src/main/resources/assets/firmament/gui/config/macros/editor.xml new file mode 100644 index 0000000..50a1d99 --- /dev/null +++ b/src/main/resources/assets/firmament/gui/config/macros/editor.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<Root xmlns="http://notenoughupdates.org/moulconfig" xmlns:firm="http://firmament.nea.moe/moulconfig" +> + <Center> + <Panel background="VANILLA" insets="10"> + <Column> + <Row> + <firm:Button onClick="@back"> + <Text text="←"/> + </firm:Button> + <Text text="Editing command macro"/> + </Row> + <Row> + <Text text="Command: /"/> + <Align horizontal="RIGHT"> + <TextField value="@command" width="200"/> + </Align> + </Row> + <Row> + <Text text="Key Combo:"/> + <Align horizontal="RIGHT"> + <firm:Button onClick="@addStep"> + <Text text="+"/> + </firm:Button> + </Align> + </Row> + <Array data="@combo"> + <Row> + <firm:Fixed width="160"> + <Indirect value="@button"/> + </firm:Fixed> + <Align horizontal="RIGHT"> + <firm:Button onClick="@delete"> + <Text text="Delete"/> + </firm:Button> + </Align> + </Row> + </Array> + </Column> + </Panel> + </Center> +</Root> diff --git a/src/main/resources/assets/firmament/gui/config/macros/index.xml b/src/main/resources/assets/firmament/gui/config/macros/index.xml new file mode 100644 index 0000000..3fa9f99 --- /dev/null +++ b/src/main/resources/assets/firmament/gui/config/macros/index.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<Root xmlns="http://notenoughupdates.org/moulconfig" + xmlns:firm="http://firmament.nea.moe/moulconfig"> + <Center> + <Tabs> + <Tab> + <Tab.Header> + <Text text="Combo Macros"/> + </Tab.Header> + <Tab.Body> + <Fragment value="firmament:gui/config/macros/combos.xml" bind="@combos"/> + </Tab.Body> + </Tab> + </Tabs> + </Center> +</Root> diff --git a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/ReplaceBlockHitSoundPatch.java b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/ReplaceBlockHitSoundPatch.java index f9a1d0d..95e7dce 100644 --- a/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/ReplaceBlockHitSoundPatch.java +++ b/src/texturePacks/java/moe/nea/firmament/mixins/custommodels/ReplaceBlockHitSoundPatch.java @@ -16,7 +16,8 @@ import org.spongepowered.asm.mixin.injection.At; @Mixin(ClientPlayerInteractionManager.class) public class ReplaceBlockHitSoundPatch { - @WrapOperation(method = "updateBlockBreakingProgress", at = @At(value = "NEW", target = "(Lnet/minecraft/sound/SoundEvent;Lnet/minecraft/sound/SoundCategory;FFLnet/minecraft/util/math/random/Random;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/client/sound/PositionedSoundInstance;")) + @WrapOperation(method = "updateBlockBreakingProgress", + at = @At(value = "NEW", target = "(Lnet/minecraft/sound/SoundEvent;Lnet/minecraft/sound/SoundCategory;FFLnet/minecraft/util/math/random/Random;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/client/sound/PositionedSoundInstance;")) private PositionedSoundInstance replaceSound( SoundEvent sound, SoundCategory category, float volume, float pitch, Random random, BlockPos pos, Operation<PositionedSoundInstance> original, diff --git a/translations/en_us.json b/translations/en_us.json index c08439f..2f66c84 100644 --- a/translations/en_us.json +++ b/translations/en_us.json @@ -129,6 +129,8 @@ "firmament.config.fixes.player-skins": "Fix unsigned Player Skins", "firmament.config.fixes.player-skins.description": "Mark all player skins as signed, preventing console spam, and some rendering issues.", "firmament.config.inventory-buttons": "Inventory buttons", + "firmament.config.inventory-buttons.hover-text": "Hover Tooltip", + "firmament.config.inventory-buttons.hover-text.description": "Hovering over inventory buttons will show the command they run.", "firmament.config.inventory-buttons.open-editor": "Open Editor", "firmament.config.inventory-buttons.open-editor.description": "Click anywhere to create a new inventory button or to edit one. Hold SHIFT to grid align.", "firmament.config.item-hotkeys": "Item Hotkeys", diff --git a/translations/extra.json b/translations/extra.json new file mode 100644 index 0000000..cb21fc9 --- /dev/null +++ b/translations/extra.json @@ -0,0 +1,6 @@ +{ + // These are require by jade, but i don't think they are actually rendered in game. + // Jade throws exceptions if they are not present however. + "config.jade.plugin_firmament.toolprovider": "Firmament Tool Provider", + "config.jade.plugin_firmament.custom_mining_hardness": "Firmament Mining Hardness" +} |