适合谁使用?
本库主要用于我的模组中,以简化用户界面(UI)/图形用户界面(GUI)的开发流程。 不过,任何人都可以将此模组作为依赖项来使用其功能。
为何使用它?
目前该模组提供以下功能;
一套新的 drawStrings() 方法,支持轻松访问自定义字体,以及为自定义边界框添加自动换行功能,并允许设置左对齐/居中/右对齐。
如何使用?
Github Wiki
导入语句
import net.spidrone.uiapi.UIAnimationManager;
import net.spidrone.uiapi.UIGraphicsHelper;
动画图形
UIAnimationManager.drawGif(GuiGraphics graphics, String imagePath, int x, int y, int frameWidth, int frameHeight, int totalFrames, int fps, float scaleX, float scaleY, float red, float green, float blue)
自定义 drawString()
UIGraphicsHelper.drawCustomFont(GuiGraphics graphics, ResourceLocation fontLocation, String message, int x, int y, int color, boolean dropShadow, TextAlign align)
带边界框/自动换行/断行的自定义 drawString()
UIGraphicsHelper.drawCustomFontBound(GuiGraphics graphics, ResourceLocation fontLocation, String message, char splitChar, int x1, int y1, int x2, int y2, int color, boolean dropShadow, TextAlign align)
如果不包含类似 fontLocation 的参数,将使用默认字体
align : LEFT/CENTER/RIGHT
若指定 splitChar "$",则 hi$world 将在你的 UI 中显示为:
hi
world
通过将 TTF 字体文件放置在你的资源文件夹中来注册字体
assets/modid/font
在同一文件夹中包含一个 .json 文件
{
"providers": [
{
"type": "ttf",
"file": "spis_ui_api:boldpixels.ttf",
"shift": [0.0, 0.0],
"size": 16.0,
"oversample": 2.0
}
]
}
在 UI 中声明字体的资源位置
public static final ResourceLocation BOLD_PIXELS_FONT = ResourceLocation.fromNamespaceAndPath("spis_ui_api", "boldpixels");
致谢
Bold Pixels :
这款字体非常适合 Minecraft
附加内容
问:你支持 X 版本吗
答:本库主要供我用于自己的项目。如果你想请求某个版本的兼容性,可以加入 Discord 服务器,但 1.21.1 之前的版本将不予考虑
Who It's For?
This library is mainly for use in my mods, to streamline creating ui/gui interfaces. However anyone can use this mod as a dependency to use its features.
Why Use It?
Currently the mod does the following; A new set of drawStrings(), which adds easily accessed custom fonts, aswell as wordwrapping to custom bounding boxes, and setting the alignment to left/center/right.
How Use It?
Github Wiki
Imports
import net.spidrone.uiapi.UIAnimationManager;
import net.spidrone.uiapi.UIGraphicsHelper;
Animated Graphics
UIAnimationManager.drawGif(GuiGraphics graphics, String imagePath, int x, int y, int frameWidth, int frameHeight, int totalFrames, int fps, float scaleX, float scaleY, float red, float green, float blue)
Custom drawString()
UIGraphicsHelper.drawCustomFont(GuiGraphics graphics, ResourceLocation fontLocation, String message, int x, int y, int color, boolean dropShadow, TextAlign align)
Custom drawString() with bounding boxes/autowrap/line splitting
UIGraphicsHelper.drawCustomFontBound(GuiGraphics graphics, ResourceLocation fontLocation, String message, char splitChar, int x1, int y1, int x2, int y2, int color, boolean dropShadow, TextAlign align)
not including something like the fontLocation will cause it to use the default font align : LEFT/CENTER/RIGHT
splitChar "$" will cause hi$world to appear on your ui as
hi
world
Register your fonts ttf by placing them in your assets folder assets/modid/font in the same folder include a .json file
{
"providers": [
{
"type": "ttf",
"file": "spis_ui_api:boldpixels.ttf",
"shift": [0.0, 0.0],
"size": 16.0,
"oversample": 2.0
}
]
}
Declare the fonts resource location in your ui
public static final ResourceLocation BOLD_PIXELS_FONT = ResourceLocation.fromNamespaceAndPath("spis_ui_api", "boldpixels");
Credits
Bold Pixels :
The font is absolutely perfect for minecraft
Extras
Q: Do you support X version
A: This library will mostly be used by me for my own projects, If you'd like to request a version you can join the discord, but nothing before 1.21.1 will be considered
下载 Spis Ui Api
下载 Spis Ui Api
下载 Spis Ui Api
下载 Spis Ui Api
下载 Spis Ui Api
下载 Spis Ui Api
下载 Spis Ui Api
下载 Spis Ui Api
下载 Spis Ui Api
下载 Spis Ui Api
暂无更新日志
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
一个用于收集生物掉落物的多区块模组。
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
查看物品与配方
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
适用于 MC 1.18+ 的 Effekseer 加载器
模组
那是什么?一个 Waila/Hwyla 的分支。
评论 0
登录后参与评分
还没有评论,来抢沙发吧