rename ControlsProfile::keyBindings

This commit is contained in:
Bixilon 2023-07-01 15:14:11 +02:00
parent ff9549e3c9
commit e973e58d98
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
2 changed files with 4 additions and 4 deletions

View File

@ -40,7 +40,7 @@ class ControlsProfile(
override val version: Int = latestVersion
override var description by StringDelegate(this, description ?: "")
var keyBindings: MutableMap<ResourceLocation, KeyBinding> by MapDelegate(this, mutableMapOf(), "")
var bindings: MutableMap<ResourceLocation, KeyBinding> by MapDelegate(this, mutableMapOf(), "")
private set
val mouse = MouseC(this)

View File

@ -34,7 +34,7 @@ class BindingsManager(
init {
profile::keyBindings.observeMap(this) {
profile::bindings.observeMap(this) {
for ((key, value) in it.adds) {
val binding = bindings[key] ?: continue
binding.binding = value
@ -112,7 +112,7 @@ class BindingsManager(
}
fun register(name: ResourceLocation, default: KeyBinding, pressed: Boolean = false, callback: KeyBindingCallback) {
val keyBinding = profile.keyBindings.getOrPut(name) { default }
val keyBinding = profile.bindings.getOrPut(name) { default }
val callbackPair = bindings.synchronizedGetOrPut(name) { KeyBindingState(keyBinding, default, pressed) }
callbackPair.callback += callback
@ -123,7 +123,7 @@ class BindingsManager(
fun registerCheck(vararg checks: Pair<ResourceLocation, KeyBinding>) {
for ((name, binding) in checks) {
bindings.synchronizedGetOrPut(name) { KeyBindingState(profile.keyBindings.getOrPut(name) { binding }, binding) }
bindings.synchronizedGetOrPut(name) { KeyBindingState(profile.bindings.getOrPut(name) { binding }, binding) }
}
}