▶️ ЗАБЕРИ СВОИ 8 ПОДАРКОВ 🎁 ПРИ СОЗДАНИИ СВОЕГО МАЙНКРАФТ СЕРВЕРА
Моды/yunfalib
yunfalib

yunfalib

A library that adds config, math, events, modules, and more.

421
2

yunfaLib

A library for Minecraft using the Fabric API that adds config, math, events, modules, and more.

Setup

build.gradle
repositories {
    maven { url "https://jitpack.io" }
}

dependencies {
    modImplementation "com.github.yunfachi:yunfaLib:${project.yunfalib_version}"
}
gradle.properties
yunfalib_version=0.1.0

Features

Config

Example Java: The values are stored in the inner class
import moe.yunfachi.yunfalib.config.Config;
import java.io.File;

public class Example {
    private static class ConfigKeys {
        String truth = "this value is immediately saved to a file";
    }
    
    public Example() {
        final Config<ConfigKeys> config = new Config<>(
                new File("./modid/config.yml"), 
                new ConfigKeys()
        );
        
        config.get().truth = "this value will be written after config.save()";
        config.save();
    }
}
Example Java: The values are stored in the nested class
import moe.yunfachi.yunfalib.config.Config;
import java.io.File;

public class Example {
    public Example() {
        final Config<ConfigKeys> config = new Config<>(
                new File("./modid/config.yml"), 
                new ConfigKeys()
        );
        
        config.get().truth = "this value will be written after config.save()";
        config.save();
    }
}

class ConfigKeys {
    String truth = "this value is immediately saved to a file";
}

Example Kotlin: The values are stored in the inner class
import moe.yunfachi.yunfalib.config.Config
import java.io.File

class Example {
    init {
        class ConfigKeys {
            var truth = "this value is immediately saved to a file"
        }

        val config = Config(
            File("./modid/config.yml"),
            ConfigKeys()
        )
        
        config.get().truth = "this value will be written after config.save()"
        config.save()
    }
}
Example Kotlin: The values are stored in an anonymous object
import moe.yunfachi.yunfalib.config.Config
import java.io.File

class Example {
    init {
        val config = Config(
            File("./modid/config.yml"),
            object {
                var truth: String = "this value is immediately saved to a file"
            }
        )

        config.get().truth = "this value will be written after config.save()"
        config.save()
    }
}

Thanks

ProjectAuthorDescription
AnnotamlWiIIiam278library for generating YAML files

Stats

Alt

Совместимость

Minecraft: Java Edition

1.20.x

Платформы

Поддерживаемые окружения

Клиент

Создатели

Детали

Лицензия:LicenseRef-All-Rights-Reserved
Опубликован:3 года назад
Обновлён:2 года назад
Главная