这是我为另一个模组 client-tweaks 提供的 API。
它允许服务器为安装了这两个模组的玩家召唤 client-tweaks 的方框轮廓,持续一个游戏刻(tick)。
用法
命令
/boxoutline 0.0 0.0 0.0 1.0 1.0 1.0 red
这会在从坐标 0,0,0 到 1,1,1 的位置绘制一个持续单个游戏刻的方框。请注意,与 client-tweaks 不同,Box Outlines API 使用小数作为坐标值。
Java 代码
首先将此模组的源代码发布到你的本地 Maven 仓库:
# 克隆仓库
git clone git@github.com:Spit365/box-outlines-api-1.21.6.git
# 发布到 maven
cd box-outlines-api-1.21.6
./gradlew publishToMavenLocal
然后在你的模组中包含 Box Outlines Api。
build.gradle:
repositories {
mavenLocal()
}
dependencies {
modImplementation("net.spit365:box-outlines-api:1.0.0")
}
fabric.mod.json:
"depends": {
"client-tweaks": "*"
}
最后,你可以在你的模组中使用以下方法:
import net.spit365.boa.BoxOutline;
import net.minecraft.util.math.Box;
import java.util.Collection;
BoxOutline.add(Box box, int color /* argb */)
BoxOutline.addAll(Collection<Box> boxes, int color /* argb */)
其作用方式相同:先指定一个方框,然后指定十六进制格式的颜色(例如 0xFFFF0000 -> 红色,完全不透明)。再次强调,这将仅持续单个游戏刻,因此为了实现持续渲染,请将其放入 tick 回调中。
构建
要从头构建此模组,首先克隆此模组和 client-tweaks 的仓库。然后,在 client-tweaks 的目录中运行:
./gradlew publishToMavenLocal
这将把它发布到你的本地 Maven 仓库。然后在 Box Outlines Api 目录中运行:
./gradlew build
为什么在构建之前需要这个额外步骤?Box Outlines Api 需要 client-tweaks 的源代码才能编译。我没有设置托管 client-tweaks 的全局 Maven,所以你需要在本地进行此操作。
其他
如果你对上述功能感兴趣,请安装此模组。
如果你不知道如何安装模组 / Fabric 加载器 / 或其他任何与 Fabric 模组开发相关的内容,请访问官方 Fabric Wiki 上的精彩页面。
如果有任何问题、建议等,请前往 GitHub 上的源代码并打开一个 Issue。
This is an api for one of my other mod client-tweaks.
It allows the server to summon box outlines from client-tweaks for a tick to those with both mods installed.
Usage
Commands
/boxoutline 0.0 0.0 0.0 1.0 1.0 1.0 red
this draws a box for a single tick from 0 0 0 to 1 1 1. Be aware that box outlines api, unlike client tweaks, uses decimals for the coordinates.
Java Code
first publish this mod's source code to your local maven
# clone the repo
git clone git@github.com:Spit365/box-outlines-api-1.21.6.git
# publish to maven
cd box-outlines-api-1.21.6
./gradlew publishToMavenLocal
then include Box Outlines Api in your mod
build.gradle:
repositories {
mavenLocal()
}
dependencies {
modImplementation("net.spit365:box-outlines-api:1.0.0")
}
fabric.mod.json:
"depends": {
"client-tweaks": "*"
}
Finally, you can use the following methods in your mod:
import net.spit365.boa.BoxOutline;
import net.minecraft.util.math.Box;
import java.util.Collection;
BoxOutline.add(Box box, int color /* argb */)
BoxOutline.addAll(Collection<Box> box, int color /* argb */)
This acts the same way, first specify a box, and then a color in hexadecimal format (0xFFFF0000 -> red, full opacity). Again, this will persist a single tick, so for continuous rendering put it in a tick callback
Building
to build this mod from scratch, first clone both this mod's and client-tweaks' repositories. Then, in the directory of client-tweaks run
./gradlew publishToMavenLocal
This will publish it to your local maven. Then run
./gradlew build
in the box outlines api directory
Why this extra step before building? Box Outlines Api needs the source code of client-tweaks available to compile. I did not set up a global maven, hosting client-tweaks, so you need to do it locally.
Other
Install this mod, if you find any of the above features intriguing.
If you dont know how to install mods / the fabric loader / anything else fabric modding related visit this amazing page from the official fabric wiki.
If you have any issues, wishes, etc, go to the source code on github and open up an issue.
评论 0
登录后参与评分
还没有评论,来抢沙发吧