本篇教程由作者设定未经允许禁止转载。
本mod在github上有较为详细的教程,但可能大部分人不太理解,所以本人来解释一下。
该mod的功能非常多,本人只介绍自定义背景,进度条,及读条数。
建议搭配Resource Loader使用,同样,本教程也基于该mod编写。
最终效果如图:
第一步:修改原始方案
找到config文件下customloadingscreen.cfg文件,将 S:screen_config 值改为可用RL读取到的类型,这里举例子使用bx/custom
第二步:定义制作素材
在.minecraft文件夹里找到resources文件夹,如果没有该文件夹请自建一个。
在其中新建文件夹,命名为customloadingscreen。
然后新建三个文件夹,分别为config,image,word。
此后,在config和image分别建一个文件夹,叫做bx(按照先前例子格式)。
在config/bx文件夹新建custom.json,并置入以下代码。
{
"renders": [
"bx/bg",
"bx/bar_down",
"bx/bar_up",
"bx/jdt"
],
"variables": {
},
"functions": [],
"factories": [
],
"actions": []
}
其中,renders里面的值均为要使用到的图片(存放于image里面),在此命名为bg(背景图),bar_down(进度条底层,白色条),
bar_up(进度条上层,蓝色渐变),jdt(百分比文本)。
第三步:制作自定义素材
你可以使用各种制作的绘图软件制作你想要的效果,在此解释一下本图的要素来源。
背景:光影在游戏截图。
进度条底和顶:在photoshop制作,尝试使用渐变。
百分比数字:ascii码表。
第四步:给这四个素材增加应用
将四张图片(只能是png格式)放在image/bx文件夹里面,并分别建议对应名字的json文本,例如:bg.json
然后输入以下的代码(背景图):
{
"parent": "builtin/image",
"image": "customloadingscreen:image/bx/bg.png",
"position_type": "CENTER",
"offset_pos": "CENTER",
"position": {
"x": "0",
"y": "0",
"width": "screen_width + 1",
"height": "screen_height + 1"
},
"texture": {
"x": "0",
"y": "0",
"width": "1",
"height": "1"
}
}
其中,注意路径,位置,大小的调整。
进度条尝试使用这一段代码:(当然你可以对位置,大小进行一定的调整)
{
"parent": "builtin/image",
"image": "customloadingscreen:image/bx/jdt.png",
"position_type": "CENTER",
"offset_pos": "CENTER",
"position": {
"x": "-screen_width * 0.4 + percentage * screen_width * 0.4",
"y": "screen_height * 0.2 - 12",
"width": "percentage * screen_width * 0.8",
"height": "4"
},
"texture": {
"x": "0",
"y": "0",
"width": "percentage",
"height": "2"
}
}
对于加载百分比数字,尝试使用以下的代码:
{
"parent": "builtin/text",
"image": "customloadingscreen:word/ascii.png",
"position_type": "CENTER",
"offset_pos": "CENTER",
"text": "(floor(percentage * 100)) + '.' + (floor(percentage * 1000) % 10) + '%'",
"position": {
"x": "0",
"y": "screen_height * 0.3 - 20",
"width": "0",
"height": "0"
},
"colour": "0xFFFFFFFF"
}
说明:ascii.png为对应的字符表(本教程放在了word文件夹),可在网站生成。
现在,你的image文件里面应该有3个png文件和4个json文件了,大功告成,进入游戏测试效果吧!