glTF Models for Everything
This mod utilizes frapi (Fabric Rendering API) to intercept block model requests. When the system requests glTF files, the mod provides them as static models that get integrated into chunk geometry in the standard way. Operating entirely on the client side, this modification enables the creation of "cursed" resource packs that replace regular blocks with non-standard shapes impossible to create in the vanilla version of the game.
Suspicious Shapes can also be used as an embedded library for implementing non-cubic blocks in other mods.
Creating Compatible Models
The easiest way to create models is using Blockbench:
- Open the program and select "New → Low Poly / Generic Model", then click "Create new model"
- Any identifiers, UV modes, and other settings will work
- After finishing work with the model, export it via "File → Export → Export glTF Model"
- Blockbench ignores most settings, so default values are perfectly suitable
- Place the exported file in the folder where json block models are usually located (for example,
assets/minecraft/models/block) - Create a child model referencing the gltf model as a parent, with a root key-value pair of
"loader": "suspicious_shapes:gltf". Here you can also specify textures and color indexes - Edit the glTF model text, replacing the texture data URL with a texture reference
Working with Textures
The most challenging part is replacing the texture. In the file you'll see code similar to this:
"images":[{"mimeType":"image/png","uri":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAr0lEQVQ4y6WTMQrCQBBFt0xtk0YQL+QR0mpnYyk5QbDObTc84YVB0NnFgSGTyf7/5w+bUpJ4LMdaeuI6jzWC5/Vcm0kAAyAleE6Hd00vkn8Fq0oCJv32up9yEg6REPGEQDLemyYR6DS3y7ATp3tQTTCEWqH3U50DcQccRl0b9lKSuAvV0wXG+AQyRTOYiDughkB76bXVgiDr5gkEeYEAu8iuf0L/WiD/Iii94diZ+gZo3N9oOnqLFAAAAABJRU5ErkJggg=="}]
This is the texture image in base64 encoding. Since block models cannot use random textures outside the atlas, this needs to be fixed. Replace each incomprehensible "uri" string with a reference to a Minecraft texture:
"images":[{"mimeType":"image/png","uri":"minecraft:blocks/stone"}]
Or, if you're creating multiple models with this shape, you can use a parent model with a regular texture reference:
"images":[{"mimeType":"image/png","uri":"#all"}]
Your child model might look like this:
{
"parent": "minecraft:block/sphere_all.gltf",
"loader": "suspicious_shapes:gltf",
"textures": {
"all": "minecraft:block/acacia_leaves"
},
"colorIndexes": [ 0 ]
}
That's it! Launch Minecraft or reload resource packs, and you'll see your model!