#Ingot/Nugget/Dust/Etc Script Creator
10 messages · Page 1 of 1 (latest)
Paste version of lounge.js from @solid coral
im gonna just add a bunch of grayscale (or similar) textures for it to auto grab from too
I'd be tempted to reduce further i.e.
const itemTemplate = (event, suffix, arr) =>
Object.entries(arr)
.forEach(([k, v]) => {
e.create(`${k}${suffix}`).color(0, v);
});
itemTemplate(e, '_plate', _plates)
Object.entries(object).forEach((key, value) => {...})
and how do you solve texture problem?
I know this might be a tad late, but if you really want to create ingots/nuggets,raws etc without having to manually go through each one.
global.Additions = [
{ material: 'atomium', color: '#fe3e8b', makeDust: true, makeRaw: true },
{ material: 'protonium', color: '#70cdff', makeDust: true, makeRaw: true },
{ material: 'nuetronium', color: '#ff620f', makeDust: true, makeRaw: true }
]
StartupEvents.registry("item", (event) => {
const mainItems = ['ingot', 'nugget'];
function mainStack(name) {
mainItems.forEach((type) => {
event
.create(`${type}_${name}`)
.texture("layer0", "mekanism:item/empty")
.texture("layer1", `kubejs:item/${type}/${name}`)
.tag(`forge:${type}s`)
.tag(`forge:${type}s/${name}`);
})
}
global.Additions.forEach((entry) => {
mainStack(entry.material)
if (entry.makeRaw) {
event
.create(`raw_${entry.material}`)
.texture("layer0", "mekanism:item/empty")
.texture("layer1", `kubejs:item/raw/${entry.material}`)
.tag(`forge:raw_materials`)
.tag(`forge:faw_materials/${entry.material}`);
}
})
})
Fun tidbit for dusts, dirty_dusts, clumps, shards, and crystals. Mekanism has assets in place that you can access for using the tint system without having to make your own. IE:
.texture("layer0", "mekanism:item/empty")
.texture("layer1", "mekanism:item/crystal")
.texture("layer2", "mekanism:item/crystal_overlay")
.color(1, #FFFFFF)
as an example.
dusts, however, do not have an overlay, so you'd have to use a method for it specifically that excludes the "_overlay" texture
Yeah, i am not using mekanism in my playground enviroment, but did end up going a similar way to you
global.mod = "examplemod";
global.Metals = [
//uses a blacklist for items to be created, leave out any you want made
{material: "example", color: 0xff1493, nugget: false, ingot: false, dust: false, rod: false, gear: false, plate: false}, //this creates nothing
{material: "example2", color: 0x000000}, //this creates every type
{material: "example3", color: 0x000000, rod: false, gear: false, plate: false}, //this creates rods, gears, and plates
]
StartupEvents.registry("item", (e) => {
const itemTypes = ["nugget", "ingot", "dust", "rod", "gear", "plate"]
function createItem(_object) {
itemTypes.forEach(itemType => {
if (_object[itemType] !== false) {
e.create(`${global.mod}:${_object.material}_${itemType}`)
.texture(`darkefae:item/${itemType}`)
//change "darkefae" to change the base texture or replace the files located in "kubejs/assets/darkefae/item"
//Tt will be colored by the color below so use a grayscale texture
.color(0, _object.color)
.tag(`forge:${itemType}s/${_object.material}`)
}
})
}
global.Metals.forEach(createItem)
})```