Версия игры
1.21 508 1.20 990 1.19 1.4K 1.18 748 1.17 1K 1.16 1.3K 1.15 555 1.14 649 1.13 44 1.12 78 1.11 57 1.10 41 1.9 67 1.8 93 1.7 26 1.6 37
RU
Y
21.11.20244300

YetAnotherConfigLib (YACL) — YetAnotherConfigLib 3.5.0 for MC 1.20.6

# YetAnotherConfigLib 3.5.0 This build supports the following versions: — Fabric 1.20.1 — Fabric 1.20.4 — Fabric 1.20.6 (also supports 1.20.5) — Fabric 1.21 — NeoForge 1.20.6 (also…

Версии1.20
ПлатформаWindows
Обновлён21.11.2024
Скачали4.6K
Работает на версии 1.20
Опубликовал: admin-planet

# YetAnotherConfigLib 3.5.0

This build supports the following versions:
— Fabric 1.20.1
— Fabric 1.20.4
— Fabric 1.20.6 (also supports 1.20.5)
— Fabric 1.21
— NeoForge 1.20.6 (also supports 1.20.5)
— NeoForge 1.20.4
— MinecraftForge 1.20.1

## *Experimental* Codec Config

This update brings a new experimental config API that utilises Mojang’s Codec for (de)serialization.

«`java
public class CodecConfig extends JsonFileCodecConfig/*or*/CodecConfig {
public static final CodecConfig INSTANCE = new CodecConfig();

public final ConfigEntry myInt =
register(«my_int", 0, Codec.INT);

public final ReadonlyConfigEntry myInnerConfig =
register(«my_inner_config", InnerCodecConfig.INSTANCE);

public CodecConfig() {
super(path);
}

void test() {
loadFromFile(); // load like this
saveToFile(); // save like this

// or if you just extend CodecConfig instead of JsonFileConfig:
JsonElement element = null;
this.decode(element, JsonOps.INSTANCE); // load
DataResult encoded = this.encodeStart(JsonOps.INSTANCE); // save
}
}
«`
or in Kotlin…
«`kotlin
object CodecConfig : JsonFileCodecConfig(path) {
val myInt by register(0, Codec.INT)

val myInnerConfig by register(InnerCodecConfig)

fun test() {
loadFromFile()
saveToFile()

// blah blah blah
}
}
«`

## Rewritten Kotlin DSL

Completely rewrote the Kotlin DSL!

«`kotlin
YetAnotherConfigLib(«namespace") {
val category by categories.registering {
val option by rootOptions.registering {
controller = slider(range = 5..10)
binding(::thisProp, default)

val otherOption by categories[«category"][«group"].futureRef()
otherOption.onReady { it.setAvailable(false) }
}

// translation key is generated automagically
val label by rootOptions.registeringLabel

val group by groups.registering {
val otherOption = options.register(«otherOption") {
controller = tickBox()
}
}
}
}
«`

## Changes

— Fix dropdown controllers erroneously showing their dropdown — Crendgrim
— Make cancel/reset and undo buttons public for accessing
— Add compatibility for 1.21

Похожие

Добавить комментарий

15 − 11 =