#how many letters can there be in the recipe id?
20 messages · Page 1 of 1 (latest)
it's definitely more than that iirc
what is it "iirc"?
if I give you my script, you won't like it, well, okay
const checking_for_an_object = (obj) => {
if (Array.isArray(obj)) return "Arry";
else if (typeof obj == "string") return "string";
else if (typeof obj == "number") return "number";
else return "object";
};
const check_id_for_event_custom = (output, type) => {
const chek = checking_for_an_object(output);
let id = "";
if (chek == "object") {
let new_1 = [];
for (let i in output) {
new_1.push(output[i]);
}
for (let i in new_1) {
id += new_1[i].split(":")[1] + "_";
}
} else if (chek == "Arry") {
let new_2 = [];
output.forEach((element) => {
for (let i in element) {
if (!Number.isInteger(Number(element[i]))) new_2.push(element[i]);
}
});
new_2 = new_2.slice(0, 2);
new_2.forEach((valus) => {
id += valus.split(":")[1] + "_";
});
} else if (chek == "string") {
id += output.split(":")[1] + "_";
}
return `${custom_config.name_pack}:${type.split(":")[0]}/${
type.split(":")[1]
}/${id.slice(0, id.length - 1)}`;
};```
this is a small part of the script responsible for the id
ingredient_tag,
count_ingredient,
resul,
count,
resul2,
count2,
resul3,
count3,
resul4,
count4,
energy
) => {
dust.push({
type: "thermal:centrifuge",
ingredient: {
tag: ingredient_tag,
count: count_ingredient,
},
result: [
{
item: resul,
count: count,
},
{
item: resul2,
count: count2,
},
{
item: resul3,
count: count3,
},
{
item: resul4,
count: count4,
},
],
energy: energy,
});
};
thermal_centrifuge(
"forge:dusts/bronze",
4,
"alltheores:copper_dust",
3,
"alltheores:tin_dust",
1,
"",
0,
"",
0,
4000
);```
onEvent("recipes", (e) => {
list.forEach((element) => {
const id = element.id;
delete element.id;
const resipe = e.custom(element);
if (Boolean(id)) resipe.id(check_id(`${custom_config.name_pack}:/${id}`));
else if (element.output) {
try {
resipe.id(
check_id(check_id_for_event_custom(element.output, element.type))
);
} catch (error) {
null;
}
} else if (element.result) {
try {
resipe.id(
check_id(check_id_for_event_custom(element.result, element.type))
);
} catch (error) {
null;
}
}
});
});
};```
256 is max length probably
Thank you, so I have problems...
That's all I've come up with so far
remove them from your code
it would be nice to fix it. When I wrote them, I was guided by examples of crafting from several mods and did not take into account much