跳到正文

yunfalib

作者:yunfachi

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

收藏

介绍

中文介绍正在准备中,下面暂时显示原文。

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

| Project | Author | Description |
|—————————————————-|———————————————|————————————|
| Annotaml | WiIIiam278 | library for generating YAML files |

Stats

Alt

常见问题

yunfalib 支持哪些 Minecraft 版本?

yunfalib 支持 Minecraft Java 版 1.20.1,可用的加载器:Fabric。下载时注意选择和你游戏版本一致的文件。

yunfalib 怎么安装?

先用 PCL2 或 HMCL 启动器安装对应版本的 Fabric,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。运行环境:仅客户端。

评论

登录后评论和评分