Fix the keystrokes positions completely, and add a setting to the cloth config screen to move them
This commit is contained in:
parent
95408f6546
commit
27bbaef032
|
@ -9,6 +9,7 @@ import fr.username404.snowygui.gui.elements.ClickBox.Companion.sortAlphabeticall
|
||||||
import fr.username404.snowygui.gui.feature.Category
|
import fr.username404.snowygui.gui.feature.Category
|
||||||
import fr.username404.snowygui.gui.feature.Colors
|
import fr.username404.snowygui.gui.feature.Colors
|
||||||
import fr.username404.snowygui.gui.feature.Macro
|
import fr.username404.snowygui.gui.feature.Macro
|
||||||
|
import fr.username404.snowygui.gui.feature.Keystrokes
|
||||||
import fr.username404.snowygui.gui.feature.riskyCheats
|
import fr.username404.snowygui.gui.feature.riskyCheats
|
||||||
import fr.username404.snowygui.gui.feature.Zoom
|
import fr.username404.snowygui.gui.feature.Zoom
|
||||||
import net.minecraft.client.gui.screens.Screen
|
import net.minecraft.client.gui.screens.Screen
|
||||||
|
@ -60,6 +61,11 @@ val SnowyConfigScreen: Screen = object: Screen(translationComponent) {
|
||||||
startBooleanToggle(TranslatableComponent("$confPrefix.behavior.zoom.smoothcamera"), Zoom.smoothCameraOnZoom).setSaveConsumer {
|
startBooleanToggle(TranslatableComponent("$confPrefix.behavior.zoom.smoothcamera"), Zoom.smoothCameraOnZoom).setSaveConsumer {
|
||||||
Zoom.smoothCameraOnZoom = it
|
Zoom.smoothCameraOnZoom = it
|
||||||
Zoom.execAction()
|
Zoom.execAction()
|
||||||
|
}.build(),
|
||||||
|
startEnumSelector(TranslatableComponent("$confPrefix.behavior.keystrokes.position"), Keystrokes.Position::class.java, Keystrokes.Position.values().find {
|
||||||
|
it.value == Keystrokes.currentPosition
|
||||||
|
}).setSaveConsumer {
|
||||||
|
Keystrokes.currentPosition = it.value
|
||||||
}.build()
|
}.build()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -107,7 +107,7 @@ object Configuration {
|
||||||
ModifiableValues.entries.fold(this) { previous, entry ->
|
ModifiableValues.entries.fold(this) { previous, entry ->
|
||||||
previous.withValue(entry.key, entry.value.let {
|
previous.withValue(entry.key, entry.value.let {
|
||||||
ConfigValueFactory.fromAnyRef(
|
ConfigValueFactory.fromAnyRef(
|
||||||
if (it !is Lazy<*>) ConfigValueFactory.fromAnyRef(it) else it.value
|
if (it !is Lazy<*>) it else it.value
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,9 @@ object Configuration {
|
||||||
when {
|
when {
|
||||||
Number::class.isSuperclassOf(T::class) -> when (T::class) {
|
Number::class.isSuperclassOf(T::class) -> when (T::class) {
|
||||||
Double::class -> 2.0
|
Double::class -> 2.0
|
||||||
Int::class, UInt::class, Short::class, UShort::class -> 2
|
Int::class, UInt::class,
|
||||||
|
Short::class, UShort::class,
|
||||||
|
Long::class, ULong::class -> 2
|
||||||
Float::class -> 2F
|
Float::class -> 2F
|
||||||
else -> throw e
|
else -> throw e
|
||||||
} as T
|
} as T
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package fr.username404.snowygui.gui.feature
|
package fr.username404.snowygui.gui.feature
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack
|
import com.mojang.blaze3d.vertex.PoseStack
|
||||||
|
import fr.username404.snowygui.config.Configuration
|
||||||
import fr.username404.snowygui.gui.ColoredElement
|
import fr.username404.snowygui.gui.ColoredElement
|
||||||
import fr.username404.snowygui.gui.Renderable
|
import fr.username404.snowygui.gui.Renderable
|
||||||
import fr.username404.snowygui.utils.FontUtil
|
import fr.username404.snowygui.utils.FontUtil
|
||||||
|
@ -9,7 +10,14 @@ import net.minecraft.client.Minecraft
|
||||||
|
|
||||||
@ButtonInfo(Category.HUD)
|
@ButtonInfo(Category.HUD)
|
||||||
object Keystrokes: ButtonImplWithHud() {
|
object Keystrokes: ButtonImplWithHud() {
|
||||||
|
var currentPosition: Double by Configuration; internal set
|
||||||
|
@Suppress("UNUSED")
|
||||||
|
enum class Position(internal val value: Double) {
|
||||||
|
LEFT(180.0),
|
||||||
|
RIGHT(-120.0)
|
||||||
|
}
|
||||||
private val hud = object : ColoredElement(x = 135.0, y = 20.0, height = 36, width = 36, color = Colors.BLACK(), opacity = 0.5F) {
|
private val hud = object : ColoredElement(x = 135.0, y = 20.0, height = 36, width = 36, color = Colors.BLACK(), opacity = 0.5F) {
|
||||||
|
override var x: Double get() = (Minecraft.getInstance().window.guiScaledWidth / 2.0) - currentPosition; set(value) = Unit
|
||||||
override var y: Double
|
override var y: Double
|
||||||
get() = Minecraft.getInstance().window.guiScaledHeight.toDouble() - yOrigin
|
get() = Minecraft.getInstance().window.guiScaledHeight.toDouble() - yOrigin
|
||||||
set(value) = Unit
|
set(value) = Unit
|
||||||
|
@ -59,4 +67,9 @@ object Keystrokes: ButtonImplWithHud() {
|
||||||
override val hudRenderLambda = Renderable {
|
override val hudRenderLambda = Renderable {
|
||||||
hud.display(it)
|
hud.display(it)
|
||||||
}
|
}
|
||||||
|
init {
|
||||||
|
if (!Position.values().map { it.value }.contains(currentPosition)) {
|
||||||
|
currentPosition = Position.LEFT.value
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue