一个简单的 Minecraft 库模组,主要用于简化我的模组开发,但任何人都可以使用!
当前支持的加载器:Fabric、Spigot 和 Paper
## 在您的项目中进行使用! 👍️
想在您的项目中使用 OtterLib 吗? 可以在您的 `build.gradle` 文件中将其添加为依赖项:
```groovy
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`)
```groovy
// 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 仓库](https://maven.oth3r.one/) 以获取有关该库的更多详细信息,包括最新版本。
## 功能
### 💬 简单的聊天构建器
*示例用法*:
```java
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 旧条目更新到新版本*:
```java
@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 提供一个自定义配置屏幕,可以自定义以提供了一种编辑多个配置文件、链接到社交媒体或打开不同屏幕的方法。
*创建屏幕*:
```java
client.setScreen(new ConfigScreen(client.currentScreen, Text.of("test"),
new CustomImage(Identifier.of(FabricTest.MOD_ID, "textures/gui/banner.png"),240, 60),
// 在中间显示的按钮列表
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()
),
// 可以自定义底部的按钮!
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()
)));
```
*游戏内主配置屏幕*:

*文件编辑器游戏内*:(计划提供单个条目编辑器,这只是一个简单的占位符)
