Let's add a new Item!
Use Pack.register_item() to add a new item, which requires an Item parameter.
pack.register_item(Item {
type_id: Identifier {
namespace: "vc",
value: "tutorial"
},
components: vec![
],
});
This will add new item. But wait... It does not have a texture!
To add a texture we first need to register it with Pack.register_item_texture() which requires an ItemAtlasEntry parameter.
pack.register_item_texture(ItemAtlasEntry {
id: "vc_test".to_string(),
texture_name: "vc_test".to_string(),
path: r"*some path*".to_string(),
});
Then let's add it to the item. Remember the components field?
pack.register_item(Item {
type_id: Identifier {
namespace: "vc",
value: "tutorial"
},
components: vec![
&ItemIconComponent {
texture: "vc_test",
},
],
});
This will add the texture to item. All item components are there. I won't document all of them. You can see the docs for them on official MC docs.