AbstractNetworkedInput.with accepts GetterSetter

This commit is contained in:
DBotThePony 2023-01-28 23:57:08 +07:00
parent 6c4d8d492b
commit fdad25cb17
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -1,6 +1,7 @@
package ru.dbotthepony.mc.otm.menu.input
import ru.dbotthepony.mc.otm.client.minecraft
import ru.dbotthepony.mc.otm.core.GetterSetter
import ru.dbotthepony.mc.otm.menu.MatteryMenu
import kotlin.reflect.KMutableProperty0
@ -27,6 +28,12 @@ abstract class AbstractNetworkedInput<V> {
return this
}
fun with(state: GetterSetter<V>): AbstractNetworkedInput<V> {
withConsumer(state::accept)
withSupplier(state::get)
return this
}
fun clear(): AbstractNetworkedInput<V> {
supplier = null
consumer = null