This repository has been archived on 2023-11-02. You can view files and clone it, but cannot push or open issues or pull requests.
jland-packwiz-pack/kubejs/server_scripts/unify_dust_processing.js
2023-11-02 12:32:44 -05:00

276 lines
8.1 KiB
JavaScript

ServerEvents.recipes((event) => {
let metals = Object.keys(metal_properties);
let nonEECompat = [
{
dust: 'ae2:certus_quartz_dust',
name: 'certus_quartz',
type: 'gems'
},
{
dust: 'ae2:fluix_dust',
name: 'fluix',
type: 'gems'
},
{
dust: 'ae2:sky_dust',
name: 'sky_stone',
type: 'stone'
},
{
dust: 'create:powdered_obsidian',
name: 'obsidian',
type: 'stone',
tag: '#forge:obsidian'
},
{
dust: 'create:cinder_flour',
name: 'netherrack',
type: 'stone',
tag: '#forge:netherrack'
}
];
let exceptions = {
// Stones
sky_stone: {
mekanism: true,
create: true
},
obsidian: {
mekanism: true,
create: true
},
netherrack: {
thermal: true,
create: true
},
// Gems
coal: {
mekanism: true,
immersiveengineering: true
},
charcoal: {
mekanism: true
},
diamond: {
mekanism: true
},
emerald: {
mekanism: true
},
fluorite: {
mekanism: true
},
lapis: {
mekanism: true
},
quartz: {
mekanism: true
},
certus_quartz: {
mekansim: true,
create: true
},
fluix: {
mekanism: true,
create: true
},
ender_pearl: {
create: true
},
// Metals
zinc: {
immersiveengineering: true
},
uranium: {
mekanism: true,
immersiveengineering: true
},
tin: {
mekanism: true,
immersiveengineering: true
},
steel: {
mekanism: true,
immersiveengineering: true
},
silver: {
immersiveengineering: true
},
rose_gold: {
immersiveengineering: true
},
refined_obsidian: {
mekanism: true
},
osmium: {
mekanism: true,
immersiveengineering: true
},
nickel: {
immersiveengineering: true
},
lead: {
mekanism: true,
immersiveengineering: true
},
iron: {
mekanism: true,
immersiveengineering: true
},
invar: {
immersiveengineering: true
},
gold: {
mekanism: true,
immersiveengineering: true
},
electrum: {
immersiveengineering: true
},
copper: {
mekanism: true,
immersiveengineering: true
},
constantan: {
immersiveengineering: true
},
bronze: {
mekanism: true,
immersiveengineering: true
},
brass: {
immersiveengineering: true
},
aluminum: {
immersiveengineering: true
}
};
metals.forEach((metal) => {
if (Item.exists(`alltheores:${metal}_dust`)) {
if (!exceptions[metal]) {
exceptions[metal] = {
occultism: true,
thermal: true
};
} else {
if (exceptions[metal].occultism == null) {
exceptions[metal].occultism = true;
}
if (exceptions[metal].thermal == null) {
exceptions[metal].thermal = true;
}
}
recipetypes_crushing(event, { name: metal, type: 'ingots' }, exceptions);
}
});
nonEECompat.forEach((material) => {
recipetypes_crushing(
event,
{ name: material.name, type: material.type },
exceptions,
material.dust,
material.tag
);
});
});
// Functions
function recipetypes_crushing(event, material, exceptions, item, tag) {
const id_prefix = 'monumental:server_scripts/dust_processing/';
let recipe = {
outputs: {
primary: { item: item == null ? `alltheores:${material.name}_dust` : item, count: 1, chance: 1 }
},
input: '',
experience: 0.25,
duration: 80,
energy: 1000,
ignore_occultism_multiplier: true,
id_suffix: '',
exceptions: exceptions[material.name]
};
if (!recipe.exceptions) recipe.exceptions = {};
recipe.input = tag == null ? `#forge:${material.type}/${material.name}` : tag;
recipe.id_suffix = `${material.type}/${material.name}_dust`;
// Occultism
if (!recipe.exceptions.occultism) {
event
.custom({
type: 'occultism:crushing',
ingredient: recipe.input.startsWith('#') ? { tag: recipe.input.slice(1) } : { item: recipe.input },
result: Item.of(recipe.outputs.primary.item, recipe.outputs.primary.count).toJson(),
crushing_time: recipe.duration,
ignore_crushing_multiplier: recipe.ignore_occultism_multiplier
})
.id(`${id_prefix}occultism_crushing/${recipe.id_suffix}`);
}
// Mekanism
if (!recipe.exceptions.mekanism) {
event
.custom({
type: 'mekanism:crushing',
input: {
ingredient: recipe.input.startsWith('#') ? { tag: recipe.input.slice(1) } : { item: recipe.input }
},
output: Item.of(recipe.outputs.primary.item, recipe.outputs.primary.count).toJson()
})
.id(`${id_prefix}mekanism_crushing/${recipe.id_suffix}`);
}
// Immersive Engineering
if (!recipe.exceptions.immersiveengineering) {
event
.custom({
type: 'immersiveengineering:crusher',
energy: recipe.energy,
input: recipe.input.startsWith('#') ? { tag: recipe.input.slice(1) } : { item: recipe.input },
result: { base_ingredient: { item: recipe.outputs.primary.item }, count: recipe.outputs.primary.count },
secondaries: []
})
.id(`${id_prefix}immersiveengineering_crusher/${recipe.id_suffix}`);
}
// Ars Nouveau
if (!recipe.exceptions.arsnouveau) {
event
.custom({
type: 'ars_nouveau:crush',
input: recipe.input.startsWith('#') ? { tag: recipe.input.slice(1) } : { item: recipe.input },
output: [recipe.outputs.primary]
})
.id(`${id_prefix}ars_nouveau_crushing/${recipe.id_suffix}`);
}
// Create
if (!recipe.exceptions.create) {
event
.custom({
type: 'create:milling',
ingredients: [recipe.input.startsWith('#') ? { tag: recipe.input.slice(1) } : { item: recipe.input }],
results: [recipe.outputs.primary],
processingTime: 50
})
.id(`${id_prefix}create_milling/${recipe.id_suffix}`);
}
// Thermal
if (!recipe.exceptions.thermal) {
event
.custom({
type: 'thermal:pulverizer',
ingredient: recipe.input.startsWith('#') ? { tag: recipe.input.slice(1) } : { item: recipe.input },
results: [
{
item: recipe.outputs.primary.item,
count: recipe.outputs.primary.count
}
],
experience: recipe.experience
})
.id(`${id_prefix}thermal_pulverizer/${recipe.id_suffix}`);
}
}