Skip to content

Commit 7ad43e7

Browse files
authored
Merge branch 'main' into dependabot/gradle/org.gradle.toolchains.foojay-resolver-convention-1.0.0
2 parents f5a040b + 96c40fb commit 7ad43e7

File tree

6 files changed

+47
-13
lines changed

6 files changed

+47
-13
lines changed

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ jobs:
3737
modrinth-id: column-quick-swap
3838
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
3939

40-
# curseforge-id: UPDATE_ME
41-
# curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
40+
curseforge-id: 1410978
41+
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
4242

4343
files: |
4444
build/libs/!(*-@(fabric|sources|dev)).jar

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Column Quick Swap
2+
3+
Quickly swap items between your hotbar and the inventory column above it.
4+
5+
## Usage
6+
7+
1. Hold **V** (default) while hovering over a hotbar slot
8+
2. A popup appears showing the 3 inventory slots directly above
9+
3. Select a slot to swap with your hotbar:
10+
- **Mouse**: Hover and release V
11+
- **Keys**: Press 1, 2, or 3 (top to bottom)
12+
- **Scroll**: Change hotbar selection while picker is open

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx4G -Xms2G -Duser.language=en -XX:+UseParallelGC
22
org.gradle.daemon=true
33
org.gradle.parallel=true
44
org.gradle.caching=true
5-
org.gradle.configuration-cache=true
5+
org.gradle.configuration-cache=false
66

77
systemProp.file.encoding=utf-8
88

src/main/kotlin/yarden_zamir/column_quick_swap/Config.kt

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,24 @@ internal val json = Json {
2121

2222
@OnlyIn(Dist.CLIENT)
2323
@Serializable
24-
data class ClientConfig(val pressTicks: Int = 20) {
24+
data class ClientConfig(
25+
/** Ticks to hold key before popup opens (0 = instant) */
26+
val pressTicks: Int = 0,
27+
/** Play sound when swapping items */
28+
val playSound: Boolean = true,
29+
/** Sound volume (0.0 to 1.0) */
30+
val soundVolume: Float = 0.3f,
31+
/** Sound pitch (higher = higher pitch) */
32+
val soundPitch: Float = 1.4f,
33+
/** Close popup and select item when key is released */
34+
val closeOnRelease: Boolean = true,
35+
/** Highlight color for hovered slot (ARGB hex) */
36+
val highlightColor: Int = 0x80FFFFFF.toInt(),
37+
/** Show item tooltips on hover */
38+
val showTooltips: Boolean = true,
39+
/** Allow scrolling to change hotbar slot while popup is open */
40+
val allowScroll: Boolean = true
41+
) {
2542
companion object {
2643
private val path = FMLPaths.CONFIGDIR.get() / "${ColumnQuickSwap.ID}.client.json"
2744

src/main/kotlin/yarden_zamir/column_quick_swap/client/ColumnPickScreen.kt

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import net.minecraftforge.api.distmarker.Dist
1313
import net.minecraftforge.api.distmarker.OnlyIn
1414
import net.minecraftforge.client.event.ScreenEvent
1515
import net.minecraftforge.common.MinecraftForge
16+
import yarden_zamir.column_quick_swap.ClientConfig
1617
import yarden_zamir.column_quick_swap.ColumnQuickSwap
1718
import yarden_zamir.column_quick_swap.DrawableNineSliceTexture
1819
import yarden_zamir.column_quick_swap.networking.C2SSwapColumnSlotPacket
@@ -101,17 +102,19 @@ class ColumnPickScreen(
101102
}
102103

103104
private fun selectSlot(columnRow: Int) {
104-
// Play click sound - quieter, higher pitch
105-
minecraft?.soundManager?.play(
106-
SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK.value(), 1.4f, 0.3f)
107-
)
105+
val cfg = ClientConfig.config
106+
if (cfg.playSound) {
107+
minecraft?.soundManager?.play(
108+
SimpleSoundInstance.forUI(SoundEvents.UI_BUTTON_CLICK.value(), cfg.soundPitch, cfg.soundVolume)
109+
)
110+
}
108111
Networking.channel.sendToServer(C2SSwapColumnSlotPacket(hotbarSlot, columnRow))
109112
onClose()
110113
}
111114

112115
override fun render(guiGraphics: GuiGraphics, mouseX: Int, mouseY: Int, partialTick: Float) {
113-
// Check if key released - select hovered item
114-
if (!SlotInteractManager.columnPicking) {
116+
// Check if key released - select hovered item (if closeOnRelease enabled)
117+
if (ClientConfig.config.closeOnRelease && !SlotInteractManager.columnPicking) {
115118
renderables.asSequence()
116119
.filterIsInstance<ColumnSlotButton>()
117120
.firstOrNull { it.isMouseOver(mouseX.toDouble(), mouseY.toDouble()) }
@@ -156,6 +159,8 @@ class ColumnPickScreen(
156159
override fun isPauseScreen(): Boolean = false
157160

158161
override fun mouseScrolled(mouseX: Double, mouseY: Double, delta: Double): Boolean {
162+
if (!ClientConfig.config.allowScroll) return false
163+
159164
// Allow scrolling to change hotbar selection
160165
val player = minecraft?.player ?: return false
161166
val inventory = player.inventory
@@ -207,8 +212,8 @@ private class ColumnSlotButton(
207212

208213
// Hover highlight
209214
if (isMouseOver(mouseX.toDouble(), mouseY.toDouble())) {
210-
guiGraphics.fill(x + 1, y + 1, x + width - 1, y + height - 1, 0x80FFFFFF.toInt())
211-
if (!item.isEmpty) {
215+
guiGraphics.fill(x + 1, y + 1, x + width - 1, y + height - 1, ClientConfig.config.highlightColor)
216+
if (!item.isEmpty && ClientConfig.config.showTooltips) {
212217
renderTooltip(guiGraphics, mouseX, mouseY)
213218
}
214219
}

src/main/kotlin/yarden_zamir/column_quick_swap/client/SlotInteractManager.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ object SlotInteractManager {
2222
private const val OPEN_COOLDOWN_MS = 100L
2323

2424
val COLUMN_PICK_KEY =
25-
KeyMapping("key.column_quick_swap.column_pick", InputConstants.KEY_G, "key.categories.inventory")
25+
KeyMapping("key.column_quick_swap.column_pick", InputConstants.KEY_V, "key.categories.inventory")
2626

2727
init {
2828
MOD_BUS.addListener { event: RegisterKeyMappingsEvent ->

0 commit comments

Comments
 (0)