2021-01-28 22:28:10 +00:00
|
|
|
//priority: 1000
|
|
|
|
|
2021-01-31 15:23:02 +00:00
|
|
|
function shapedRecipe(result, pattern, key, id) {
|
|
|
|
return { result: result, pattern: pattern, key: key, id: id };
|
2021-01-28 22:28:10 +00:00
|
|
|
}
|
|
|
|
|
2021-01-31 15:23:02 +00:00
|
|
|
function shapelessRecipe(result, ingredients, id) {
|
|
|
|
return { result: result, ingredients: ingredients, id: id };
|
2021-01-28 22:28:10 +00:00
|
|
|
}
|
|
|
|
function unificationBlacklistEntry(material, type) {
|
|
|
|
return { material: material, type: type };
|
|
|
|
}
|
|
|
|
function entryIsBlacklisted(material, type) {
|
|
|
|
for (var i = 0; i < unificationBlacklist.length; i++) {
|
|
|
|
if (unificationBlacklist[i].material === material && unificationBlacklist[i].type === type) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
function tagIsEmpty(tag) {
|
|
|
|
return getPreferredItemInTag(ingredient.of(tag)).id == air;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getPreferredItemInTag(tag) {
|
|
|
|
const pref = wrapArray(tag.stacks).sort(({ mod: a }, { mod: b }) => compareIndices(a, b, tag))[0] || item.of(air);
|
|
|
|
// console.info('Preferred item: ' + tag + ' => ' + pref);
|
|
|
|
return pref;
|
|
|
|
}
|
|
|
|
function compareIndices(a, b, tag) {
|
|
|
|
if (a == b) return 0; // iff a == b, they'll be found at the same position in modPriorities
|
|
|
|
|
|
|
|
for (let mod of modPriorities) {
|
|
|
|
if (mod == a) return -1; // if a comes before b, then idx(a) < idx(b), so -1
|
|
|
|
if (mod == b) return 1; // if a comes after b, then idx(a) > idx(b), so 1
|
|
|
|
}
|
|
|
|
|
|
|
|
console.error('[' + a + ', ' + b + '] were both unaccounted for in mod unification' + (tag ? ' for ' + tag : '!'));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
function wrapArray(array) {
|
|
|
|
return utils.listOf(array).toArray();
|
|
|
|
}
|
|
|
|
const unificationBlacklist = [
|
|
|
|
unificationBlacklistEntry('quartz', 'gem'),
|
|
|
|
unificationBlacklistEntry('quartz', 'storage_block')
|
|
|
|
];
|