跳到正文

OtterLib

作者:Oth3r

一个酷炫的全新简易前置模组,所有人都能用!

收藏

介绍

介绍由机器翻译自 CurseForge 原页面,仅供参考。

一个简单的 Minecraft 前置库模组,主要是为了让我更轻松地开发自己的模组,但任何人都可以使用!
目前支持的加载器:Fabric、Spigot 和 Paper

在你的项目中使用!👍️

想在项目中使用 OtterLib?可以在 build.gradle 文件中将它添加为依赖项:

repositories {
    maven {
        name "oth3rMavenSnapshots"
        url "https://maven.oth3r.one/snapshots"
    }
}

在各个加载器上的依赖配置如下,其中 ${project.otterlib_version} 是 OtterLib 对应加载器的当前版本(例如 0.2.0.0+1.21.6、0.2.0.0+1.20-1.21.6)

// fabric
modImplementation "one.oth3r:otterlib:${project.otterlib_version}-fabric"
// spigot
implementation "one.oth3r:otterlib:${project.otterlib_version}-spigot"
// paper
implementation "one.oth3r:otterlib:${project.otterlib_version}-paper"

访问 Maven 仓库,了解有关该前置库的更多详细信息,包括最新版本。

功能

💬 简易聊天消息构建器

用法示例:

player.sendMessage(new CTxT("Hello").color(Color.BLUE).bold(true).strikethrough(true)
    .append(new CTxT("World!!!!!!!!!").rainbow(new Rainbow(true)).underline(true).italic(true)).b());

游戏内效果示例:

游戏内效果示例

📜 自定义语言读取器

OtterLib 提供了一个自定义语言读取器,让你可以在所有受支持的加载器上轻松实现服务端本地化。它还支持为语言文件设置备用位置,方便玩家自定义覆盖。

🗃️ 稳健的文件保存与加载

提供一个接口,可轻松创建配置文件,并方便地保存、加载和更新版本。

将旧版 JSON 条目更新为新版:

@Override
public void update(JsonElement jsonElement) {
    JsonObject file = jsonElement.getAsJsonObject();
    if (file.get("version").getAsDouble() == 1.0) {
        this.version = 1.1;
        this.test = file.get("test-bool").getAsBoolean();
    }
}

⚙️ 自定义配置界面

OtterLib 提供了可自定义的配置界面,可用于编辑多个配置文件、链接到社交媒体,甚至打开不同的界面。

创建界面:

client.setScreen(new ConfigScreen(client.currentScreen, Text.of("test"),
    new CustomImage(Identifier.of(FabricTest.MOD_ID, "textures/gui/banner.png"),240, 60),
    // the list of buttons to be displayed in the middle
    List.of(
            SimpleButton.Templates.fileEditor(new CTxT("Test File"), FabricTest.testFile, new CustomImage(Identifier.of(FabricTest.MOD_ID, "button/server_button"),246,26)).build(),
            SimpleButton.Templates.fileEditor(new CTxT("Test File No Image"), FabricTest.testFile).build(),
            SimpleButton.Templates.wiki(new CTxT("Help")).openLink("https://oth3r.one").size(30,30).build(),
            SimpleButton.Templates.wiki(new CTxT("Help")).openLink("https://oth3r.one").size(30,30).build(),
            SimpleButton.Templates.warning(new CTxT("Help")).openLink("https://oth3r.one").size(150,15).hideText(false).build()
    ),
    // the bottom buttons can be customized!
    List.of(
            new SimpleButton.Builder(new CTxT("Donate"))
                    .miniIcon(new CustomImage(Identifier.of(Assets.ID, "icon/donate"),15,15)).build(),
            SimpleButton.Templates.donate(new CTxT("Donate")).openLink(URI.create("https://ko-fi.com/oth3r")).build(),
            SimpleButton.Templates.done(new CTxT("Done")).build(),
            SimpleButton.Templates.wiki(new CTxT("Wiki")).openLink("https://oth3r.one").build()
    )));

游戏内的主配置界面:

main config screen

游戏内的文件编辑器:(单个条目编辑器正在计划中,目前这里只是一个简单的占位内容)

file config screen

常见问题

OtterLib 支持哪些 Minecraft 版本?

OtterLib 支持 Minecraft Java 版 1.20.1–26.3,共 18 个版本,可用的加载器:Fabric / Quilt。下载时注意选择和你游戏版本一致的文件。

OtterLib 怎么安装?

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

评论

登录后评论和评分

Oth3r 的其他作品

查看全部 →