适用于所有事物的 glTF 模型
本模组利用 frapi(Fabric 渲染 API)拦截方块模型的请求。如果这些请求指向 glTF 文件,它会将它们作为静态模型提供,并按常规方式烘焙到区块几何体中。这是一个纯客户端模组,可用于支持那些“诡异”的资源包,将现有方块替换为原版无法制作的非立方体形状。
它也可以作为“内置”模组使用,为你的模组提供非立方体方块的支撑。
详细说明
在 Blockbench 中创建兼容模型是最简单的方法。
- 在应用中,选择“新建 -> 低多边形/通用模型”,然后点击“创建新模型”按钮。
- 任何标识符、UV 模式或其他设置均可。
- 当你满意你的模型后,点击“文件 -> 导出 -> 导出 glTF 模型”。
- Blockbench 会忽略大多数设置,默认值完全没问题。
- 找到你导出的文件,并将其放在你通常放置 json 方块模型的位置(例如
assets/minecraft/models/block)。 - 创建一个子模型,将该 gltf 模型作为父级引用,其根键值对为
"loader": "suspicious_shapes:gltf"。你也可以在此处填写纹理引用并设置颜色索引。 - 编辑 glTF 模型的文本,用纹理引用替换纹理的数据 URL。
最后一步是最难的。在你打开的文件中,你会看到类似以下内容:
"images":[{"mimeType":"image/png","uri":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAr0lEQVQ4y6WTMQrCQBBFt0xtk0YQL+QR0mpnYyk5QbDObTc84YVB0NnFgSGTyf7/5w+bUpJ4LMdaeuI6jzWC5/Vcm0kAAyAleE6Hd00vkn8Fq0oCJv32up9yEg6REPGEQDLemyYR6DS3y7ATp3tQTTCEWqH3U50DcQccRl0b9lKSuAvV0wXG+AQyRTOYiDughkB76bXVgiDr5gkEeYEAu8iuf0L/WiD/Iii94diZ+gZo3N9oOnqLFAAAAABJRU5ErkJggg=="}]
这是你所用纹理的 base64 编码图像。由于方块模型不能使用不在纹理图集(atlas)中的随机纹理,我们必须对此进行修改。将每个标记为 "uri" 的不可读字符串替换为 Minecraft 纹理引用,如下所示:
"images":[{"mimeType":"image/png","uri":"minecraft:blocks/stone"}]
或者,如果你正在使用此形状制作多个模型,可以像往常一样将其作为父级并使用向上引用的纹理:
"images":[{"mimeType":"image/png","uri":"#all"}]
你的子模型可能看起来像这样:
{
"parent": "minecraft:block/sphere_all.gltf",
"loader": "suspicious_shapes:gltf",
"textures": {
"all": "minecraft:block/acacia_leaves"
},
"colorIndexes": [ 0 ]
}
就是这样!启动 Minecraft 或重载资源包,你应该就能看到你的模型了!
glTF models for everything
Using frapi (the fabric-rendering API), this mod intercepts requests for block models, and if they refer to glTF files, provides them as static models that get baked into the chunk geometry as normal. Entirely clientside, this mod can be used to power "cursed" resource packs that replace existing blocks with non-cuboid shapes that vanilla can't make.
It can also be used as an "included" mod to power non-cuboid blocks in your mods.
The Details
The easiest way to create a compatible model is in Blockbench.
- From the app, select "New -> Low Poly / Generic Model" and hit the "Create new model" button.
- Any identifier, UV mode, or other settings are fine.
- When you're satisfied with your model, hit "File -> Export -> Export glTF Model".
- Blockbench ignores most of these settings, and the defaults are perfectly fine.
- Find the file you exported and put it where you would normally put a json blockmodel (e.g.
assets/minecraft/models/block) - make a child model which refers to the gltf model as a parent, with a root key-value pair of
"loader": "suspicious_shapes:gltf". You can fill-in texture references and set color indices here too. - Edit the text of the glTF model to replace the texture's data URL with a texture reference.
The last part there is the hard part. In the file you'll see something like,
"images":[{"mimeType":"image/png","uri":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAr0lEQVQ4y6WTMQrCQBBFt0xtk0YQL+QR0mpnYyk5QbDObTc84YVB0NnFgSGTyf7/5w+bUpJ4LMdaeuI6jzWC5/Vcm0kAAyAleE6Hd00vkn8Fq0oCJv32up9yEg6REPGEQDLemyYR6DS3y7ATp3tQTTCEWqH3U50DcQccRl0b9lKSuAvV0wXG+AQyRTOYiDughkB76bXVgiDr5gkEeYEAu8iuf0L/WiD/Iii94diZ+gZo3N9oOnqLFAAAAABJRU5ErkJggg=="}]
This is a base-64 encoded image of the texture you used. Since block models can't use random textures that aren't in the atlas, we'll have to fix that. Replace each of the unreadable strings marked "uri" with a minecraft texture reference, like this
"images":[{"mimeType":"image/png","uri":"minecraft:blocks/stone"}]
Or, if you're making several models with this shape, you can use it as a parent with a texture up-reference like normal:
"images":[{"mimeType":"image/png","uri":"#all"}]
Your child model can look something like this:
{
"parent": "minecraft:block/sphere_all.gltf",
"loader": "suspicious_shapes:gltf",
"textures": {
"all": "minecraft:block/acacia_leaves"
},
"colorIndexes": [ 0 ]
}
And that's it! Load up minecraft or reload resource packs and you should see your model!
下载 Suspicious Shapes
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Suspicious Shapes
下载 Suspicious Shapes
下载 Suspicious Shapes
下载 Suspicious Shapes
下载 Suspicious Shapes
下载 Suspicious Shapes
这是将 Suspicious Shapes 移植到 1.21.1 的版本,基本未作改动。在大多数情况下,为原版设计的资源包也能在新版本中正常工作。
此前,Suspicious Shapes 会忽略那些父模型指向 gltf 但未包含以下键值对的模型:
"loader": "suspicious_shapes:gltf"
新版本将该键进行了命名空间处理,以便在与 Connector 和/或即将推出的 Fabric 模型加载器 API 共存时减少侵入性。模型的配置应更新如下:
"suspicious_shapes:loader": "suspicious_shapes:gltf"
对此可能造成的不便深表歉意,但我保证,由此带来的全新模组交互体验将让这一切努力都值得。
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
可定制的鞘翅模组,支持装饰纹饰、旗帜图案等更多功能!
模组
一个用于收集生物掉落物的多区块模组。
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
查看物品与配方
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
评论 0
登录后参与评分
还没有评论,来抢沙发吧