rewrite the ore processing to be even less code, buff compatability for agricultural automation

This commit is contained in:
2025-06-29 14:36:19 +02:00
parent 0e19f47a67
commit ce717ad665
17 changed files with 413 additions and 509 deletions

View File

@ -1,3 +1,4 @@
// FIXME: Cannot process alltheores:raw_nickel
ServerEvents.recipes(event => {
// Metal tiers:
// Copper, iron, tin, nickel, gold, zinc, brass, invar, bronze - Pre-basic build tier, the only ores that don't require a pulverizer or smelter to process
@ -13,20 +14,54 @@ ServerEvents.recipes(event => {
// invar, gold, silver, electrum, signalum, lead, steel - Gated behind gear die
// lumium, enderium, other alloys - Gated behind heavy duty gear die
let metalForm = (metal, tag, form) => {
let itemType = AlmostUnified.getPreferredItemForTag(`forge:${tag}/${metal}`);
if (itemType.id == 'minecraft:air') {
console.log(`metals: ${metal} ${form} has unknown tag forge:${tag}/${metal}?`)
let ret = Item.of(`alltheores:${metal}_${form}`);
if (ret.id == "minecraft:air") {
return Item.of(`thermal:${metal}_${form}`);
let rawForms = (metal) => {
let ret = null;
AlmostUnified.getItemIds(`forge:raw_materials/${metal}`).forEach(id => {
if (ret == null) {
ret = Ingredient.of(id);
} else {
ret = ret.or(id);
}
return ret;
}
console.log(`metals: forge:${tag}/${metal} found`);
return itemType;
});
return ret;
}
let metalForm = global.metalForm;
let alloyIngredients = (forms, ingredients) => {
let real_ingredients = [];
for (const ingredient of ingredients.slice(1)) {
let real_item = Item.of(ingredient);
if (real_item.id == 'minecraft:air') {
let real_ingredient = null;
for (const form of forms) {
let parts = ingredient.split(' ');
if (parts.length == 1) {
real_item = metalForm(parts[0], form);
} else {
real_item = metalForm(parts[1], form).withCount(parts[0].split('x')[0]);
}
if (real_item.id == 'minecraft:air') {
console.error(`Unknown or invalid alloy ${form} ingredient: ${ingredient}`);
} else {
if (real_ingredient == null) {
real_ingredient = Ingredient.of(real_item);
} else {
real_ingredient = real_ingredient.or(real_item);
}
//real_ingredients.push(real_item);
}
}
//console.error(`Ingredients: ${real_ingredients}`);
//real_ingredients.push(Ingredient.apply(null, real_ingredients));
real_ingredients.push(real_ingredient);
} else {
real_ingredients.push(real_item);
}
}
return real_ingredients;
};
// Progression
// Vanilla age -> Ore hammer for crushing tin to make andesite alloy
// Andesite age -> Mixer from andesite allow allows creating early alloys: bronze, brass, invar, constantan
@ -98,7 +133,6 @@ ServerEvents.recipes(event => {
},
// Andesite age: Iron pickaxe to mine, crushing wheels to crush, then the crushed ore is smelted normally. Alloys require the create mixer. Ore washing to double crushed ore is unlocked, but fans require invar instead of iron. Gears can be crafted on a crafting table
andesite: {
silver: [],
aluminum: [],
lead: [],
rose_gold: [2, 'copper', 'gold'],
@ -108,6 +142,7 @@ ServerEvents.recipes(event => {
},
// Mechanical/grist age: Ores require diamond pick, crushed in the pulverizer, and crushed ore is smelted normally. Alloys require the induction furnace. 4x ore centrifuge is unlocked after creating a constantan gear on the crafting table. Other gears require the press.
mechanical: {
silver: [],
nickel: [],
invar: [3, '2x iron', 'nickel'],
electrum: [2, 'gold', 'silver'],
@ -140,9 +175,12 @@ ServerEvents.recipes(event => {
};
// Basic rules for all materials
for (const [key, metals] of Object.entries(progression)) {
for (const [tier, metals] of Object.entries(progression)) {
for (const [metal, ingredients] of Object.entries(metals)) {
console.log(`Running ore processing for ${metal}...`);
let rawType = metalForm(metal, 'raw_materials', 'ore');
let rawIngredients = rawForms(metal);
let crushedType = Item.of(`create:crushed_raw_${metal}`);
let dustType = metalForm(metal, 'dusts', 'dust');
@ -155,8 +193,6 @@ ServerEvents.recipes(event => {
let gearType = metalForm(metal, 'gears', 'gear');
let rodType = metalForm(metal, 'rods', 'rod');
console.log(`Wiping out stock ore processing for ${metal}...`);
// Wipe out all the stock recipes
event.remove({output: gearType});
event.remove({output: dustType});
@ -168,93 +204,105 @@ ServerEvents.recipes(event => {
event.remove({output: nuggetType});
event.remove({output: crushedType});
event.remove({input: crushedType});
console.warn(`Removing ${metal} ingot recipes for ${ingotType.id}`);
// All dusts and crushed ores can be smelted to ingots, and dusts can be created from crushing ingots
let ingotSources = [];
// All forms can be crushed back into dust
if (dustType.id != 'minecraft:air') {
event.smelting(ingotType, dustType);
event.shapeless(dustType, [ingotType, '#alltheores:ore_hammers']);
event.recipes.create.crushing(dustType, ingotType);
event.recipes.create.milling(dustType, ingotType);
let dustSource = null;
[gearType, rodType, plateType, ingotType].forEach(form => {
if (form.id != 'minecraft:air') {
if (dustSource == null) {
dustSource = Ingredient.of(form);
} else {
dustSource = dustSource.or(form);
}
}
});
event.shapeless(dustType, [dustSource, '#alltheores:ore_hammers']);
event.recipes.create.crushing(dustType, dustSource);
event.recipes.create.milling(dustType, dustSource);
event.recipes.thermal.pulverizer(dustType, dustSource);
}
// Plates can always be smelted back into their original ingot, and crushed back into dust
// All forms, including crushed ores, can be smelted back into an ingot
if (ingotType.id != 'minecraft:air') {
let ingotSource = null;
[gearType, rodType, plateType, dustType, crushedType].forEach(form => {
if (form.id != 'minecraft:air') {
if (ingotSource == null) {
ingotSource = Ingredient.of(form);
} else {
ingotSource = ingotSource.or(form);
}
}
});
if (ingotSource != null) {
event.smelting(ingotType, ingotSource);
} else {
console.error(`Unable to generate ${metal} ingot smelting from derivatives`);
}
}
// Gears and ingots can be pressed into a plate
if (plateType.id != 'minecraft:air') {
event.smelting(ingotType, plateType);
// 1 plate = 1 ingot in presses
event.recipes.thermal.press(plateType, [ingotType]);
event.recipes.create.pressing([plateType], [ingotType]);
event.recipes.create.crushing(dustType, plateType);
event.recipes.create.milling(dustType, plateType);
event.recipes.thermal.pulverizer(dustType, plateType);
}
// Gears can also be crushed back into dust
if (gearType.id != 'minecraft:air') {
event.recipes.create.crushing(dustType, gearType);
event.recipes.create.milling(dustType, gearType);
event.recipes.thermal.pulverizer(dustType, gearType);
}
// Same for rods
if (rodType.id != 'minecraft:air') {
event.recipes.create.crushing(dustType, rodType);
event.recipes.create.milling(dustType, rodType);
event.recipes.thermal.pulverizer(dustType, rodType);
let plateSource = null;
[gearType, ingotType].forEach(form => {
if (form.id != 'minecraft:air') {
if (plateSource == null) {
plateSource = Ingredient.of(form);
} else {
plateSource = plateSource.or(form);
}
}
})
event.recipes.thermal.press(plateType, plateSource);
event.recipes.create.pressing(plateType, plateSource);
}
// 4 ingots = 1 gear in the press
if (gearType.id != 'minecraft:air') {
event.recipes.thermal.press(gearType, [ingotType.withCount(4), 'thermal:press_gear_die']);
event.recipes.thermal.press(gearType, [ingotType.withCount(4), 'thermal:press_gear_die']).id(`kubejs:${metal}_gear_in_thermal_press`);
}
// 9 Nuggets == 1 ingot, for every material
if (nuggetType.id != 'minecraft:air') {
event.shapeless(ingotType, [nuggetType.withCount(9)]);
event.shapeless(nuggetType.withCount(9), [ingotType]);
event.shapeless(ingotType, [nuggetType.withCount(9)]).id(`kubejs:${metal}_ingot_from_nuggets`);
event.shapeless(nuggetType.withCount(9), [ingotType]).id(`kubejs:${metal}_nuggets_from_ingot`);
event.recipes.thermal.press(ingotType, [nuggetType.withCount(9), 'thermal:press_packing_3x3_die']).id(`kubejs:${metal}_ingot_from_nuggets_in_thermal_press`);
event.recipes.thermal.press(nuggetType.withCount(9), [ingotType, 'thermal:press_unpacking_die']).id(`kubejs:${metal}_nuggets_from_ingot_in_thermal_press`);
}
// 9 ore = 1 ore block
if (rawType.id != 'minecraft:air') {
event.shapeless(rawBlockType, [rawType.withCount(9)]);
event.shapeless(rawType.withCount(9), [rawBlockType]);
if (rawIngredients != null) {
event.shapeless(rawBlockType, [rawIngredients.withCount(9)]).id(`kubejs:${metal}_ore_block_from_ore`);
event.shapeless(rawType.withCount(9), [rawBlockType]).id(`kubejs:${metal}_ore_from_ore_block`);
event.recipes.thermal.press(rawBlockType, [rawIngredients.withCount(9), 'thermal:press_packing_3x3_die']).id(`kubejs:${metal}_ore_block_from_ore_in_thermal_press`);
event.recipes.thermal.press(rawType.withCount(9), [rawBlockType, 'thermal:press_unpacking_die']).id(`kubejs:${metal}_ore_from_ore_block_in_thermal_press`);
}
// 9 ingots = 1 block
if (blockType.id != 'minecraft:air') {
event.shapeless(blockType, [ingotType.withCount(9)]);
event.shapeless(ingotType.withCount(9), [blockType]);
event.shapeless(blockType, [ingotType.withCount(9)]).id(`kubejs:${metal}_block_from_ingots`);
event.shapeless(ingotType.withCount(9), [blockType]).id(`kubejs:${metal}_ingots_from_block`);
event.recipes.thermal.press(blockType, [ingotType.withCount(9), 'thermal:press_packing_3x3_die']).id(`kubejs:${metal}_block_from_ingots_in_thermal_press`);
event.recipes.thermal.press(ingotType.withCount(9), [blockType, 'thermal:press_unpacking_die']).id(`kubejs:${metal}_ingots_from_block_in_thermal_press`);
}
// All alloys can be created in the thermal smelter, or a superheated create mixer
if (ingredients.length > 0) {
for (const form of ['ingots', 'dusts']) {
let real_ingredients = [];
for (const ingredient of ingredients.slice(1)) {
let real_item = Item.of(ingredient);
if (real_item.id == 'minecraft:air') {
let parts = ingredient.split(' ');
if (parts.length == 1) {
real_item = metalForm(parts[0], form);
} else {
real_item = metalForm(parts[1], form).withCount(parts[0].split('x')[0]);
}
}
let real_ingredients = alloyIngredients(['ingots', 'dusts'], ingredients);
if (real_item.id == 'minecraft:air') {
console.error(`Unknown or invalid ${metal} alloy ingredient: ${ingredient}`);
}
real_ingredients.push(real_item);
}
if (real_ingredients.length == 0) {
console.error(`Unable to create ingots from ${form} for ${metal}!`);
if (real_ingredients.length == 0) {
console.error(`Unable to create ingots from ${form} for ${metal}!`);
} else {
// If we have 3 or fewer ingredients, we can create it in the 3-slot thermal smelter
if (real_ingredients.length <= 3) {
event.recipes.thermal.smelter(ingotType.withCount(ingredients[0]), real_ingredients);
event.recipes.create.mixing(ingotType.withCount(ingredients[0]), real_ingredients).heated();
} else {
// If we have 3 or fewer ingredients, we can create it in the 3-slot thermal smelter
if (real_ingredients.length <= 3) {
event.recipes.thermal.smelter(ingotType.withCount(ingredients[0]), real_ingredients);
event.recipes.create.mixing(ingotType.withCount(ingredients[0]), real_ingredients).heated();
} else {
// Materials with 4 or more require superheating, and can only be made in the mixer
event.recipes.create.mixing(ingotType.withCount(ingredients[0]), real_ingredients).superheated();
}
// Materials with 4 or more require superheating, and can only be made in the mixer
event.recipes.create.mixing(ingotType.withCount(ingredients[0]), real_ingredients).superheated();
}
}
}
@ -285,7 +333,7 @@ ServerEvents.recipes(event => {
// Vanilla tier: Ores need an ore hammer, and alloys can be crafted on the crafting table
for (const tier of ['primitive', 'vanilla']) {
for (const [metal, ingredients] of Object.entries(progression[tier])) {
let rawType = metalForm(metal, 'raw_materials', 'ore');
let rawIngredients = rawForms(metal);
let dustType = metalForm(metal, 'dusts', 'dust');
let ingotType = metalForm(metal, 'ingots', 'ingot');
let rawBlockType = metalForm(`raw_${metal}`, 'storage_blocks', 'block');
@ -293,51 +341,32 @@ ServerEvents.recipes(event => {
console.log(`Building vanilla processing for ${metal}...`);
// Crush raw ore into dust with an ore hammer, in crafting table and in the deployer
if (rawType.id != 'minecraft:air') {
event.shapeless(dustType, [rawType, '#alltheores:ore_hammers']);
if (rawIngredients != null) {
event.shapeless(dustType, [rawIngredients, '#alltheores:ore_hammers']);
event.shapeless(dustType.withCount(9), [rawBlockType, '#alltheores:ore_hammers']);
event.recipes.create.deploying([dustType], [rawType, '#alltheores:ore_hammers']).keepHeldItem();
event.recipes.create.deploying([dustType], [rawIngredients, '#alltheores:ore_hammers']).keepHeldItem();
event.recipes.create.deploying([dustType.withCount(9)], [rawBlockType, '#alltheores:ore_hammers']).keepHeldItem();
} else {
console.warn(`No ${metal} ore hammer smashing available!`);
console.log(`No ${metal} ore hammer smashing available due to missing raw form!`);
}
// TODO: alloy ingredients
for (const form of ['ingots', 'dusts']) {
let real_ingredients = [];
for (const ingredient of ingredients.slice(1)) {
let real_item = Item.of(ingredient);
if (real_item.id == 'minecraft:air') {
let parts = ingredient.split(' ');
if (parts.length == 1) {
real_item = metalForm(parts[0], form);
} else {
real_item = metalForm(parts[1], form).withCount(parts[0].split('x')[0]);
}
}
if (real_item.id == 'minecraft:air') {
console.error(`Unknown or invalid ${metal} alloy ingredient: ${ingredient}`);
} else {
real_ingredients.push(real_item);
}
}
let real_ingredients = alloyIngredients(['ingots', 'dusts'], ingredients);
if (real_ingredients.length > 0 && ingotType.id != 'minecraft:air') {
event.shapeless(ingotType.withCount(ingredients[0]), real_ingredients);
}
if (real_ingredients.length > 0 && ingotType.id != 'minecraft:air') {
event.shapeless(ingotType.withCount(ingredients[0]), real_ingredients);
}
}
}
// Andesite alloy is the progression item, as it unlocks most of the next tier of create
event.shapeless('create:andesite_alloy', [global.dustItem('tin'), '2x minecraft:andesite']);
//event.shapeless('create:andesite_alloy', [global.dustItem('tin'), '2x minecraft:andesite']);
let xpNugget = Item.of('create:experience_nugget');
// Andesite age: Crushing wheels to crush, then the crushed ore is smelted normally. Alloys require the create mixer. Ore washing to double crushed ore is unlocked, but fans require invar instead of iron. Gears can be crafted on a crafting table
for (const tier of ['primitive', 'vanilla', 'andesite']) {
for (const [metal, ingredients] of Object.entries(progression[tier])) {
let rawType = metalForm(metal, 'raw_materials', 'ore');
let rawIngredients = rawForms(metal);
let crushedType = Item.of(`create:crushed_raw_${metal}`);
let dustType = metalForm(metal, 'dusts', 'dust');
let ingotType = metalForm(metal, 'ingots', 'ingot');
@ -347,11 +376,11 @@ ServerEvents.recipes(event => {
console.log(`Building andesite processing for ${metal}...`);
if (rawType.id != 'minecraft:air') {
if (rawIngredients != null) {
if (crushedType.id != 'minecraft:air') {
event.recipes.create.crushing([crushedType.withCount(2), xpNugget.withCount(2).withChance(0.75)], rawType);
event.recipes.create.crushing([crushedType.withCount(2), xpNugget.withCount(2).withChance(0.75)], rawIngredients);
event.recipes.create.crushing([crushedType.withCount(18), xpNugget.withCount(18).withChance(0.75)], rawBlockType);
event.recipes.create.milling([crushedType.withCount(2)], rawType);
event.recipes.create.milling([crushedType.withCount(2)], rawIngredients);
event.recipes.create.milling([crushedType.withCount(18)], rawBlockType);
event.smelting(ingotType, crushedType);
@ -384,29 +413,10 @@ ServerEvents.recipes(event => {
console.warn(`No ${metal} plates available!`);
}
// TODO: alloy ingredients
for (const form of ['ingots', 'dusts']) {
let real_ingredients = [];
for (const ingredient of ingredients.slice(1)) {
let real_item = Item.of(ingredient);
if (real_item.id == 'minecraft:air') {
let parts = ingredient.split(' ');
if (parts.length == 1) {
real_item = metalForm(parts[0], form);
} else {
real_item = metalForm(parts[1], form).withCount(parts[0].split('x')[0]);
}
}
if (real_item.id == 'minecraft:air') {
console.error(`Unknown or invalid ${metal} alloy ingredient: ${ingredient}`);
}
real_ingredients.push(real_item);
}
let real_ingredients = alloyIngredients(['ingots', 'dusts'], ingredients);
if (real_ingredients.length > 0) {
event.recipes.create.mixing(ingotType.withCount(ingredients[0]), real_ingredients).heated();
}
if (real_ingredients.length > 0) {
event.recipes.create.mixing(ingotType.withCount(ingredients[0]), real_ingredients).heated();
}
}
}
@ -420,45 +430,24 @@ ServerEvents.recipes(event => {
// Mechanical/grist age: Ores require diamond pick, crushed in the pulverizer, and crushed ore is smelted normally. Alloys require blending dusts in a heated mixer, then smelting the blend. 4x ore centrifuge is unlocked after creating a constantan gear on the crafting table. Other gears require the press.
for (const tier of ['primitive', 'vanilla', 'andesite', 'mechanical']) {
for (const [metal, ingredients] of Object.entries(progression[tier])) {
let rawType = metalForm(metal, 'raw_materials', 'ore');
let crushedType = Item.of(`create:crushed_raw_${metal}`);
let dustType = metalForm(metal, 'dusts', 'dust');
let ingotType = metalForm(metal, 'ingots', 'ingot');
console.log(`Building mechanical processing for ${metal}...`);
if (rawType.id != 'minecraft:air') {
if (crushedType.id != 'minecraft:air') {
// Crushed ores are created in the industrial tier code, but mechanical tier and below are the only ones that don't need a centrifuge first
// This allows Nickel to be processed into a constantan gear, which unlocks the centrifuge
event.smelting(ingotType, [crushedType]);
} else {
console.error(`No ${metal} ore pulverizing available! Falling back to dust-based processing line`);
}
if (crushedType.id != 'minecraft:air') {
// Crushed ores are created in the industrial tier code, but mechanical tier and below are the only ones that don't need a centrifuge first
// This allows Nickel to be processed into a constantan gear, which unlocks the centrifuge
event.smelting(ingotType, [crushedType]);
} else {
console.error(`No ${metal} ore pulverizing available! Falling back to dust-based processing line`);
}
for (const form of ['dusts']) {
let real_ingredients = [];
for (const ingredient of ingredients.slice(1)) {
let real_item = Item.of(ingredient);
if (real_item.id == 'minecraft:air') {
let parts = ingredient.split(' ');
if (parts.length == 1) {
real_item = metalForm(parts[0], form);
} else {
real_item = metalForm(parts[1], form).withCount(parts[0].split('x')[0]);
}
}
let real_ingredients = alloyIngredients(['dusts'], ingredients);
if (real_item.id == 'minecraft:air') {
console.error(`Unknown or invalid ${metal} alloy ingredient: ${ingredient}`);
}
real_ingredients.push(real_item);
}
if (real_ingredients.length > 0) {
event.recipes.create.mixing(dustType.withCount(ingredients[0]), real_ingredients).heated();
}
if (real_ingredients.length > 0) {
event.recipes.create.mixing(dustType.withCount(ingredients[0]), real_ingredients).heated();
}
}
}
@ -467,13 +456,13 @@ ServerEvents.recipes(event => {
// Industrial age: Ores require centrifuging, alloys require basic grists, gears can only be made with a gear die
for (const tier of ['primitive', 'vanilla', 'andesite', 'mechanical', 'industrial']) {
for (const [metal, ingredients] of Object.entries(progression[tier])) {
let rawType = metalForm(metal, 'raw_materials', 'ore');
let rawIngredients = rawForms(metal);
let crushedType = Item.of(`create:crushed_raw_${metal}`);
let dustType = metalForm(metal, 'dusts', 'dust');
let rawBlockType = metalForm(`raw_${metal}`, 'storage_blocks', 'block');
if (rawType.id != 'minecraft:air') {
if (rawIngredients != null) {
if (crushedType.id != 'minecraft:air') {
event.recipes.thermal.pulverizer([crushedType.withCount(4), crushedType.withChance(0.25), xpNugget.withCount(4).withChance(0.75)], rawType);
event.recipes.thermal.pulverizer([crushedType.withCount(4), crushedType.withChance(0.25), xpNugget.withCount(4).withChance(0.75)], rawIngredients);
event.recipes.thermal.pulverizer([crushedType.withCount(4 * 9), crushedType.withChance(0.25), xpNugget.withCount(4 * 9).withChance(0.75)], rawBlockType);
event.recipes.thermal.centrifuge([dustType.withCount(4), dustType.withChance(0.25)], crushedType);
} else {
@ -482,263 +471,45 @@ ServerEvents.recipes(event => {
}
}
}
// Generate clay from centrifuing ash or gravel
event.recipes.thermal.centrifuge([
Item.of('minecraft:clay_ball').withChance(1.05),
Item.of('minecraft:clay_ball').withChance(0.25)],
'supplementaries:ash_brick'
);
event.recipes.thermal.centrifuge([
Item.of('minecraft:clay_ball').withChance(1.75),
Item.of('minecraft:clay_ball').withChance(0.85)],
'minecraft:gravel'
);
// Let quartz dust be created in the crafting table with a hammer
event.shapeless('thermal:quartz_dust',
['minecraft:quartz', '#alltheores:ore_hammers']
).id('kubejs:quartz_dust_crushing');
// Fix up the diamond gear recipe, which somehow has two duplicates
event.remove({output: 'thermal:diamond_gear'});
event.shaped('thermal:diamond_gear', [
' A ',
'ABA',
' A '
], {
'A': 'minecraft:diamond',
'B': '#kubejs:grist/build/basic'
});
//event.recipes.create.crushing(dustType, dustSource);
event.recipes.create.milling('create:powdered_obsidian', 'minecraft:obsidian');
});
function foobar() {
function shpaes() {
event.shapeless('thermal:quartz_dust', ['8x minecraft:granite', '#alltheores:ore_hammers']).id('kubejs:quartz_dust_from_granit_crushing_manual_only');
event.shapeless('thermal:quartz_dust', ['minecraft:quartz', '#alltheores:ore_hammers']).id('kubejs:quartz_dust_crushing_manual_only');
// All metals can be processed in the pulverizer/crusher, make plates in the press, and make gears with the die
{
let _ = ['copper', 'rose_gold', 'aluminum', 'constantan', 'iron', 'tin', 'nickel', 'gold', 'zinc', 'brass', 'invar', 'bronze', 'silver', 'platinum', 'lead', 'iridium', 'osmium', 'lumium', 'enderium', 'electrum', 'signalum', 'steel', 'uranium'].forEach(metal => {
console.log(`Setting up Tier 3 ${metal} processing...`);
let gearType = metalForm(metal, 'gears', 'gear');
let dustType = metalForm(metal, 'dusts', 'dust');
let plateType = metalForm(metal, 'plates', 'plate');
let ingotType = metalForm(metal, 'ingots', 'ingot');
let rawType = metalForm(metal, 'raw_materials', 'ore');
let blockType = metalForm(`raw_${metal}`, 'storage_blocks', 'block');
let crushedType = Item.of(`create:crushed_raw_${metal}`);
event.remove({output: gearType});
event.remove({output: plateType});
event.remove({input: `#forge:ores/${metal}`});
event.remove({input: `#forge:raw_materials/${metal}`});
// By default, you can't make any blends in the crafting table.
event.remove({output: dustType, type: 'minecraft:crafting'});
event.remove({output: ingotType, input: 'minecraft:fire_charge'});
// Remove the default conversion of ingot to nuggets from create
event.remove({input: ingotType, type: 'create:crushing'});
// And completely eliminate the default refining line with create crushed ores
if (crushedType.id != 'minecraft:air') {
event.remove({input: crushedType});
event.remove({output: crushedType});
} else {
console.log(`metals: Missing create:crushed_raw_${metal}`);
}
event.remove({id: `alltheores:${metal}_dust_from_alloy_blending`});
console.log(`crushing ${rawType.toJson()} ${dustType.toJson()}`);
if (rawType.id != "minecraft:air") {
event.custom({
type: "thermal:pulverizer",
ingredients: [
{tag: `forge:raw_materials/${metal}`}
],
result: [
{item: dustType.id, chance: 1.05},
{item: dustType.id, chance: 0.25}
],
experience: 0.5
});
if (crushedType.id != 'minecraft:air') {
event.custom({
type: "create:crushing",
ingredients: [
{tag: `forge:raw_materials/${metal}`}
],
results: [
{item: crushedType.id, chance: 1},
{item: crushedType.id, chance: 0.25},
{item: dustType.id, chance: 0.05},
{item: 'create:experience_nugget', count: 2, chance: 0.75}
],
});
}
}
if (blockType.id != "minecraft:air") {
event.custom({
type: "thermal:pulverizer",
ingredients: [
{tag: `forge:storage_blocks/raw_${metal}`}
],
result: [
{item: dustType.id, count: 9, chance: 1},
{item: dustType.id, count: 9, chance: 0.25}
],
experience: 0.5
});
if (crushedType.id != 'minecraft:air') {
event.custom({
type: "create:crushing",
ingredients: [
{tag: `forge:storage_blocks/raw_${metal}`}
],
results: [
{item: crushedType.id, count: 9, chance: 1},
{item: crushedType.id, count: 9, chance: 0.25},
{item: dustType.id, count: 9, chance: 0.05},
{item: 'create:experience_nugget', count: 2 * 9, chance: 0.75}
],
});
}
}
// Set up the parallel create-based ore washing line
if (crushedType.id != 'minecraft:air') {
event.custom({
type: "create:splashing",
ingredients: [
{item: crushedType.id }
],
results: [
{item: dustType.id, count: 2, chance: 1},
{item: dustType.id, chance: 0.25},
{item: dustType.id, chance: 0.05},
],
});
event.custom({
type: "thermal:centrifuge",
ingredients: [
{item: crushedType.id }
],
result: [
{item: dustType.id, count: 3, chance: 3.0},
{item: dustType.id, chance: 0.75},
{item: "twigs:pebble", chance: 0.05}
],
});
}
// 1 dust = 1 ingot
event.custom({
type: "thermal:pulverizer",
ingredients: [
ingotType.toJson()
],
result: [
dustType.toJson()
],
});
event.custom({
type: "create:crushing",
ingredients: [
ingotType.toJson()
],
results: [
dustType.toJson()
],
});
// 4 ingots = 1 gear
event.custom({
type: "thermal:press",
ingredients: [
ingotType.withCount(4).toJson(),
{ item: "thermal:press_gear_die" }
],
result: [gearType.toJson()]
});
// 1 ingot = 1 plate
event.custom({
type: "thermal:press",
ingredients: [
ingotType.toJson(),
],
result: [plateType.toJson()]
});
event.custom({
type: "create:pressing",
ingredients: [
ingotType.toJson(),
],
results: [plateType.toJson()]
});
});}
// But only these metals can be processed without a machine
{let _ = ['copper', 'iron', 'tin', 'nickel', 'zinc', 'brass', 'bronze', 'lead', 'aluminum'].forEach(metal => {
console.log(`Setting up ${metal} manual processing...`);
let gearID = metalForm(metal, 'gears', 'gear');
let plateID = metalForm(metal, 'plates', 'plate');
let dustID = metalForm(metal, 'dusts', 'dust');
event.shaped(gearID, [
' A ',
'ABA',
' A '
], {
'A': global.ingotItem(metal),
'B': '#forge:gems'
});
event.shapeless(plateID, [global.ingotItem(metal, 2), '#alltheores:ore_hammers']).id(`kubejs:plate_crushing_${metal}_manual_only`);
event.shapeless(dustID, [global.ingotItem(metal), '#alltheores:ore_hammers']).id(`kubejs:ore_crushing_${metal}_manual_only`);
});}
// And only these ores can be hammered or crushed
{let _ = ['copper', 'iron', 'tin', 'nickel', 'zinc', 'lead', 'aluminum', 'gold'].forEach(ore => {
console.log(`Setting up ${ore} hammering...`);
let dustType = metalForm(ore, 'dusts', 'dust');
event.shapeless(dustType.withCount(2), [`#forge:raw_materials/${ore}`, '#alltheores:ore_hammers']).id(`kubejs:ore_crushing_2_${ore}_manual_only`);
event.shapeless(dustType.withCount(2 * 9), [`#forge:storage_blocks/raw_${ore}`, '#alltheores:ore_hammers']).id(`kubejs:ore_block_crushing_${ore}_manual_only`);
});}
// And only copper can be smelted without pulverizing
event.smelting(global.ingotItem('copper'), metalForm('copper', 'raw_materials', 'ore'));
console.log(`Setting up blends...`);
// These are the only blends you can make by hand, aka pre-smelter alloys
// FIXME: Remove the hammer from the create mixer
event.shapeless(Item.of(metalForm('bronze', 'dusts', 'dust').withCount(4)), [
global.dustItem('tin', 2),
global.dustItem('copper', 2),
'#alltheores:ore_hammers'
]).id('kubejs:bronze_mixing_manual_only');
event.custom({
type: "create:mixing",
ingredients: [
global.dustItem('tin', 2),
global.dustItem('copper', 2),
],
results: [global.dustItem('tin', 4)]
});
event.shapeless(Item.of(metalForm('brass', 'dusts', 'dust').withCount(4)), [
global.dustItem('copper', 3),
global.dustItem('zinc', 1),
'#alltheores:ore_hammers'
]).id(`kubejs:brass_mixing_manual_only`);
event.custom({
type: "create:mixing",
ingredients: [
global.dustItem('copper', 3),
global.dustItem('zinc', 1),
],
results: [global.dustItem('brass', 4)]
});
event.shapeless(Item.of(metalForm('invar', 'dusts', 'dust').withCount(4)), [
global.dustItem('iron', 2),
global.dustItem('nickel', 2),
'#alltheores:ore_hammers'
]).id('kubejs:invar_mixing_manual_only');
event.custom({
type: "create:mixing",
ingredients: [
global.dustItem('iron', 2),
global.dustItem('nickel', 2),
],
results: [global.dustItem('invar', 4)]
});
// Constantan dust consumes your first build grist, and it unlocks the basic grist production line
event.shapeless(Item.of(metalForm('constantan', 'dusts', 'dust').withCount(4)),[
global.ingotItem('nickel', 2),
global.ingotItem('copper', 2),
'#kubejs:grist/build/basic',
'#alltheores:ore_hammers'
]).id('kubejs:constantan_dust_mixing_manual_only');
// Constantan is the only metal you can't work on the bench except for gears
event.shaped('thermal:constantan_gear', [
' A ',
@ -757,7 +528,7 @@ function foobar() {
'A': 'minecraft:diamond',
'B': 'minecraft:crying_obsidian'
});
// Lapis can be pulverized and hammered.
event.remove({output: 'thermal:lapis_dust', type: 'thermal:pulverizer'});
event.custom({