Refactor of material recipes (#2732)

* refactor

* phew

* drive-by fix

* all done I think

* cleaned up some lines that didn't do anything, added more comments, removed log spam
This commit is contained in:
Pyritie 2026-01-14 21:36:52 +00:00 committed by GitHub
parent 8c6551dda6
commit 2e10938e1c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 2107 additions and 3303 deletions

View file

@ -0,0 +1,527 @@
// priority: 0
"use strict";
// TODO: merge these two tag prefixes
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processSmallOre(event, material) {
if (!material.hasFlag(TFGMaterialFlags.HAS_SMALL_TFC_ORE))
return;
const smallOre = ChemicalHelper.get(TFGTagPrefix.oreSmall, material, 1);
const smallDust = ChemicalHelper.get(TagPrefix.dustSmall, material, 1);
let materialName = material.getName();
event.recipes.gtceu.macerator(`tfg:macerate_${materialName}_small_ore`)
.itemInputs(smallOre)
.itemOutputs(smallDust)
.duration(material.getMass())
.category(GTRecipeCategories.ORE_CRUSHING)
.EUt(GTValues.VA[GTValues.ULV])
event.recipes.tfc.quern(smallDust, smallOre)
.id(`tfg:quern/small_${materialName}`)
if (material.hasProperty(TFGPropertyKey.TFC_PROPERTY)) {
addTFCMelting(event, smallOre, material, 16, 'small_ore');
}
}
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
* @param {*} oreProperty
* The material's ore property
* @param {number} multiplier
* How many ingots/gems/dusts each ore item should smelt into.
* Can be a non-integer, in which case it'll smelt into nuggets/small dusts etc.
* @param {Internal.ItemStack} oreItem
* The input item to be smelted
* @param {string} type
* The type of ore being smelted, used for recipe IDs
*/
function smeltOre(event, material, oreProperty, multiplier, oreItem, type) {
const smeltingMaterial = oreProperty.getDirectSmeltResult().isNull() ? material : oreProperty.getDirectSmeltResult();
if (!material.hasProperty(PropertyKey.BLAST) && !material.hasFlag(MaterialFlags.NO_ORE_SMELTING)) {
let ingotItem;
if (smeltingMaterial.hasProperty(PropertyKey.INGOT)) {
ingotItem = ChemicalHelper.getIngot(smeltingMaterial, GTValues.M * multiplier)
}
else if (smeltingMaterial.hasProperty(PropertyKey.GEM)) {
if (multiplier >= 1) {
ingotItem = ChemicalHelper.get(TagPrefix.gem, smeltingMaterial, multiplier)
}
else {
ingotItem = ChemicalHelper.get(TagPrefix.gemFlawed, smeltingMaterial, 1)
}
}
else {
ingotItem = ChemicalHelper.getDust(smeltingMaterial, GTValues.M * multiplier)
}
if (!ingotItem.isEmpty()) {
event.smelting(ingotItem, oreItem).id(`gtceu:smelting/smelt_${type}_${material.getName()}_ore_to_ingot`)
}
}
}
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processPoorRawOre(event, material) {
const poorOreItem = ChemicalHelper.get(TFGTagPrefix.poorRawOre, material, 1)
const crushedOreItem = ChemicalHelper.get(TagPrefix.crushed, material, 1)
if (poorOreItem === null || crushedOreItem === null)
return;
const materialName = material.getName();
const oreProperty = material.getProperty(PropertyKey.ORE)
const multiplier = oreProperty.getOreMultiplier();
crushedOreItem.setCount(crushedOreItem.getCount() * multiplier)
// Forge hammer
let hammerRecipe = event.recipes.gtceu.forge_hammer(`hammer_poor_raw_${materialName}_to_crushed_ore`)
.itemInputs(poorOreItem)
.category(GTRecipeCategories.ORE_FORGING)
.duration(100)
.EUt(16)
if (material.hasProperty(PropertyKey.GEM)) {
const gemItem = ChemicalHelper.get(TagPrefix.gem, material, crushedOreItem.getCount());
hammerRecipe.chancedOutput(gemItem, 7500, 950)
event.recipes.greate.pressing(Item.of(gemItem).withChance(0.75), poorOreItem)
.recipeTier(1)
.id(`greate:pressing/poor_raw_${materialName}_to_gem`)
let polishingCount = Math.max(crushedOreItem.getCount() / 2, 1);
event.recipes.create.sandpaper_polishing(gemItem.copyWithCount(polishingCount), poorOreItem)
.id(`tfg:polishing/poor_raw_${materialName}_to_gem`)
} else {
hammerRecipe.chancedOutput(crushedOreItem, 7500, 950)
event.recipes.greate.pressing(Item.of(crushedOreItem).withChance(0.75), poorOreItem)
.recipeTier(1)
.id(`greate:pressing/poor_raw_${materialName}_to_crushed_ore`)
}
// Macerator
let maceratorRecipe = event.recipes.gtceu.macerator(`macerate_poor_raw_${materialName}_ore_to_crushed_ore`)
.itemInputs(poorOreItem)
.category(GTRecipeCategories.ORE_CRUSHING)
.duration(400)
.EUt(2)
if (multiplier > 1) {
maceratorRecipe.itemOutputs(crushedOreItem.copyWithCount(multiplier / 2))
} else {
maceratorRecipe.chancedOutput(crushedOreItem, 5000, 750)
}
maceratorRecipe.chancedOutput(crushedOreItem.copyWithCount(1), 2500, 500)
maceratorRecipe.chancedOutput(crushedOreItem.copyWithCount(1), 1250, 250)
// Quern
if (multiplier > 1) {
event.recipes.tfc.quern(
crushedOreItem.copyWithCount(multiplier / 2),
poorOreItem
).id(`tfg:quern/${materialName}_crushed_ore_from_poor_raw_ore`)
} else {
event.recipes.tfc.quern(
ChemicalHelper.get(TagPrefix.dustSmall, material, 2),
poorOreItem
).id(`tfg:quern/${materialName}_crushed_ore_from_poor_raw_ore`)
}
// Smelting
smeltOre(event, material, oreProperty, multiplier / 2, poorOreItem, 'poor')
// Melting
const tfcProperty = material.getProperty(TFGPropertyKey.TFC_PROPERTY);
if (tfcProperty !== null) {
addTFCMelting(event, poorOreItem, material, global.calcAmountOfMetalProcessed(24, tfcProperty.getPercentOfMaterial()), 'poor_raw_ore');
}
}
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processNormalRawOre(event, material) {
const oreProperty = material.getProperty(PropertyKey.ORE)
const multiplier = oreProperty.getOreMultiplier();
const normalOreItem = ChemicalHelper.get(TagPrefix.rawOre, material, 1)
const crushedOreItem = ChemicalHelper.get(TagPrefix.crushed, material, multiplier)
if (normalOreItem === null || crushedOreItem === null)
return;
const materialName = material.getName();
// Forge hammer
let hammerRecipe = event.recipes.gtceu.forge_hammer(`hammer_raw_${materialName}_to_crushed_ore`)
.itemInputs(normalOreItem)
.category(GTRecipeCategories.ORE_FORGING)
.duration(100)
.EUt(16)
if (material.hasProperty(PropertyKey.GEM)) {
const gemItem = ChemicalHelper.get(TagPrefix.gem, material, crushedOreItem.getCount())
hammerRecipe.itemOutputs(gemItem)
event.recipes.greate.pressing(gemItem, normalOreItem)
.recipeTier(1)
.id(`greate:pressing/raw_${materialName}_to_gem`)
event.recipes.create.sandpaper_polishing(gemItem, normalOreItem)
.id(`tfg:polishing/raw_${materialName}_to_gem`)
} else {
hammerRecipe.itemOutputs(crushedOreItem)
event.recipes.greate.pressing(crushedOreItem, normalOreItem)
.recipeTier(1)
.id(`greate:pressing/raw_${materialName}_to_crushed_ore`)
}
event.remove({ id: `greate:milling/integration/gtceu/macerator/macerate_raw_${materialName}_ore_to_crushed_ore` })
// Macerator
event.recipes.gtceu.macerator(`macerate_raw_${materialName}_ore_to_crushed_ore`)
.itemInputs(normalOreItem)
.itemOutputs(crushedOreItem)
.chancedOutput(crushedOreItem.copyWithCount(1), 5000, 500)
.chancedOutput(crushedOreItem.copyWithCount(1), 2500, 250)
.chancedOutput(crushedOreItem.copyWithCount(1), 1250, 250)
.category(GTRecipeCategories.ORE_CRUSHING)
.duration(400)
.EUt(2)
// Quern
event.recipes.tfc.quern(crushedOreItem, normalOreItem)
.id(`tfg:quern/${materialName}_crushed_ore_from_normal_raw_ore`)
// Remove ore block recipes
event.remove({ id: `gtceu:compressor/compress_${materialName}_to_raw_ore_block` })
event.remove({ id: `gtceu:forge_hammer/decompress_${materialName}_to_raw_ore` })
// Smelting
smeltOre(event, material, oreProperty, multiplier, normalOreItem, 'raw')
// Melting
const tfcProperty = material.getProperty(TFGPropertyKey.TFC_PROPERTY);
if (tfcProperty !== null) {
addTFCMelting(event, normalOreItem, material, global.calcAmountOfMetalProcessed(36, tfcProperty.getPercentOfMaterial()), 'raw_ore');
}
}
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processRichRawOre(event, material) {
const oreProperty = material.getProperty(PropertyKey.ORE)
const multiplier = oreProperty.getOreMultiplier() * 2;
const richOreItem = ChemicalHelper.get(TFGTagPrefix.richRawOre, material, 1)
const crushedOreItem = ChemicalHelper.get(TagPrefix.crushed, material, multiplier)
if (richOreItem === null || crushedOreItem === null)
return;
const materialName = material.getName();
// Forge hammer
let hammerRecipe = event.recipes.gtceu.forge_hammer(`hammer_rich_raw_${materialName}_to_crushed_ore`)
.itemInputs(richOreItem)
.category(GTRecipeCategories.ORE_FORGING)
.duration(100)
.EUt(16)
if (material.hasProperty(PropertyKey.GEM)) {
const gemItem = ChemicalHelper.get(TagPrefix.gem, material, crushedOreItem.getCount())
hammerRecipe.itemOutputs(gemItem)
event.recipes.greate.pressing(gemItem, richOreItem)
.recipeTier(1)
.id(`greate:pressing/rich_raw_${materialName}_to_gem`)
event.recipes.create.sandpaper_polishing(gemItem, richOreItem)
.id(`tfg:polishing/rich_raw_${materialName}_to_gem`)
} else {
hammerRecipe.itemOutputs(crushedOreItem)
event.recipes.greate.pressing(crushedOreItem, richOreItem)
.recipeTier(1)
.id(`greate:pressing/rich_raw_${materialName}_to_crushed_ore`)
}
// Macerator
event.recipes.gtceu.macerator(`macerate_rich_raw_${materialName}_ore_to_crushed_ore`)
.itemInputs(richOreItem)
.itemOutputs(crushedOreItem)
.chancedOutput(crushedOreItem.copyWithCount(1), 5000, 750)
.chancedOutput(crushedOreItem.copyWithCount(1), 2500, 500)
.chancedOutput(crushedOreItem.copyWithCount(1), 1250, 250)
.category(GTRecipeCategories.ORE_CRUSHING)
.duration(400)
.EUt(2)
// Quern
event.recipes.tfc.quern(crushedOreItem, richOreItem)
.id(`tfg:quern/${materialName}_crushed_ore_from_rich_raw_ore`)
// Smelting
smeltOre(event, material, oreProperty, multiplier, richOreItem, 'rich')
// Melting
const tfcProperty = material.getProperty(TFGPropertyKey.TFC_PROPERTY);
if (tfcProperty !== null) {
addTFCMelting(event, richOreItem, material, global.calcAmountOfMetalProcessed(48, tfcProperty.getPercentOfMaterial()), 'rich_raw_ore');
}
}
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processCrushedOre(event, material) {
const crushedOreItem = ChemicalHelper.get(TagPrefix.crushed, material, 1)
const impureDustItem = ChemicalHelper.get(TagPrefix.dustImpure, material, 1)
const pureOreItem = ChemicalHelper.get(TagPrefix.crushedPurified, material, 1)
const materialName = material.getName();
if (crushedOreItem !== null && pureOreItem !== null) {
// Bulk washing
let byproductMaterial = material.getProperty(PropertyKey.ORE).getOreByProduct(0, material);
const byproductItem = ChemicalHelper.get(TagPrefix.dust, byproductMaterial, 1)
event.recipes.greate.splashing([pureOreItem, Item.of(byproductItem).withChance(0.333), 'gtceu:stone_dust'], crushedOreItem)
.id(`tfg:splashing/${materialName}_purified_ore`)
// Dropping in water
event.custom({
type: "ae2:transform",
circumstance: {
type: "fluid",
tag: "tfc:any_water"
},
ingredients: [
crushedOreItem.toJson()
],
result: pureOreItem.toJson()
}).id(`tfg:ae_transform/${materialName}_purified_ore`)
event.recipes.tfc.barrel_instant()
.inputItem(crushedOreItem)
.inputFluid(Fluid.of("minecraft:water", 10))
.outputItem(pureOreItem)
.id(`tfg:instant_barrel/${materialName}_purified_ore`)
// Melting
const tfcProperty = material.getProperty(TFGPropertyKey.TFC_PROPERTY);
if (tfcProperty !== null) {
addTFCMelting(event, crushedOreItem, material, global.calcAmountOfMetalProcessed(80, tfcProperty.getPercentOfMaterial()), 'purified_ore');
}
}
if (crushedOreItem !== null && impureDustItem !== null) {
event.recipes.greate.pressing(impureDustItem, crushedOreItem)
.recipeTier(1)
.id(`greate:pressing/crushed_${materialName}_to_impure_dust`)
}
}
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processPurifiedOre(event, material) {
const pureOreItem = ChemicalHelper.get(TagPrefix.crushedPurified, material, 1)
const pureDustItem = ChemicalHelper.get(TagPrefix.dustPure, material, 1)
if (pureOreItem !== null && pureDustItem !== null) {
event.recipes.greate.pressing(pureDustItem, pureOreItem)
.recipeTier(1)
.id(`greate:pressing/pure_crushed_${material.getName()}_to_pure_dust`)
const tfcProperty = material.getProperty(TFGPropertyKey.TFC_PROPERTY);
if (tfcProperty !== null) {
addTFCMelting(event, pureOreItem, material, global.calcAmountOfMetalProcessed(100, tfcProperty.getPercentOfMaterial()), 'pure_crushed');
}
}
}
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processRefinedOre(event, material) {
const refinedOreItem = ChemicalHelper.get(TagPrefix.crushedRefined, material, 1)
const dustItem = ChemicalHelper.get(TagPrefix.dust, material, 1)
if (refinedOreItem !== null && dustItem !== null) {
event.recipes.greate.pressing(dustItem, refinedOreItem)
.recipeTier(1)
.id(`greate:pressing/refined_${material.getName()}_to_dust`)
const tfcProperty = material.getProperty(TFGPropertyKey.TFC_PROPERTY);
if (tfcProperty !== null) {
addTFCMelting(event, refinedOreItem, material, global.calcAmountOfMetalProcessed(110, tfcProperty.getPercentOfMaterial()), 'refined_crushed');
}
}
}
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processImpureDust(event, material) {
const impureDustItem = ChemicalHelper.get(TagPrefix.dustImpure, material, 1)
const dustItem = ChemicalHelper.get(TagPrefix.dust, material, 1)
if (impureDustItem !== null && dustItem !== null) {
const materialName = material.getName();
// Bulk washing
event.recipes.greate.splashing(dustItem, impureDustItem)
.id(`tfg:splashing/${materialName}_dust_from_impure`)
event.recipes.tfc.barrel_instant()
.inputItem(impureDustItem)
.inputFluid(Fluid.of("minecraft:water", 10))
.outputItem(dustItem)
.id(`tfg:instant_barrel/${materialName}_dust_from_impure`)
// Centrifuging
let byproductMaterial = material.getProperty(PropertyKey.ORE).getOreByProduct(0, material);
event.recipes.vintageimprovements.centrifugation(
[dustItem, Item.of(ChemicalHelper.get(TagPrefix.dust, byproductMaterial, 1)).withChance(0.111)],
impureDustItem)
.processingTime(material.getMass() * 10 * global.VINTAGE_IMPROVEMENTS_DURATION_MULTIPLIER)
.id(`tfg:vi/centrifuge/${materialName}_dust_from_impure`)
// Dropping in water
event.custom({
type: "ae2:transform",
circumstance: {
type: "fluid",
tag: "tfc:any_water"
},
ingredients: [
impureDustItem.toJson()
],
result: dustItem.toJson()
}).id(`tfg:ae_transform/${materialName}_dust_from_impure`)
// Melting
const tfcProperty = material.getProperty(TFGPropertyKey.TFC_PROPERTY);
if (tfcProperty !== null) {
addTFCMelting(event, impureDustItem, material, global.calcAmountOfMetalProcessed(100, tfcProperty.getPercentOfMaterial()), 'impure_dust');
}
}
}
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processPureDust(event, material) {
const pureDustItem = ChemicalHelper.get(TagPrefix.dustPure, material, 1);
const dustItem = ChemicalHelper.get(TagPrefix.dust, material, 1);
if (pureDustItem !== null && dustItem !== null) {
const materialName = material.getName();
// Bulk washing
event.recipes.greate.splashing(dustItem, pureDustItem)
.id(`tfg:splashing/${materialName}_dust_from_pure`)
event.recipes.tfc.barrel_instant()
.inputItem(pureDustItem)
.inputFluid(Fluid.of("minecraft:water", 10))
.outputItem(dustItem)
.id(`tfg:instant_barrel/${materialName}_dust_from_pure`)
// Centrifuging
let byproductMaterial = material.getProperty(PropertyKey.ORE).getOreByProduct(1, material);
event.recipes.vintageimprovements.centrifugation(
[dustItem, Item.of(ChemicalHelper.get(TagPrefix.dust, byproductMaterial, 1)).withChance(0.111)],
pureDustItem)
.processingTime(material.getMass() * 10 * global.VINTAGE_IMPROVEMENTS_DURATION_MULTIPLIER)
.id(`tfg:vi/centrifuge/${materialName}_dust_from_pure`)
// Dropping in water
event.custom({
type: "ae2:transform",
circumstance: {
type: "fluid",
tag: "tfc:any_water"
},
ingredients: [
pureDustItem.toJson()
],
result: dustItem.toJson()
}).id(`tfg:ae_transform/${materialName}_dust_from_pure`)
// Melting
const tfcProperty = material.getProperty(TFGPropertyKey.TFC_PROPERTY);
if (tfcProperty !== null) {
addTFCMelting(event, pureDustItem, material, global.calcAmountOfMetalProcessed(120, tfcProperty.getPercentOfMaterial()), 'pure_dust');
}
}
}
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processGems(event, material) {
const gemItem = ChemicalHelper.get(TagPrefix.gem, material, 1);
if (gemItem.isEmpty() || gemItem.hasTag('c:hidden_from_recipe_viewers'))
return;
const materialName = material.getName();
const budItem = ChemicalHelper.get(TFGTagPrefix.budIndicator, material, 1);
if (!budItem.isEmpty()) {
event.recipes.tfc.damage_inputs_shapeless_crafting(
event.shapeless(budItem, [gemItem, '#tfc:chisels']))
.id(`shapeless/${materialName}_bud_indicator`)
}
const chipped = ChemicalHelper.get(TagPrefix.gemChipped, material, 1)
const smallDust = ChemicalHelper.get(TagPrefix.dustSmall, material, 1)
if (!chipped.isEmpty()) {
event.shaped(smallDust, [
'A', 'B'
], {
A: chipped,
B: '#forge:tools/mortars'
}).id(`shapeless/mortar_chipped_${materialName}`)
}
const amount = getMaterialAmount(TagPrefix.block, material);
event.recipes.greate.pressing(ChemicalHelper.get(TagPrefix.gem, material, amount), ChemicalHelper.get(TagPrefix.block, material, 1))
.recipeTier(0)
.id(`greate:pressing/unpacking_${materialName}_block`)
event.recipes.tfc.quern(ChemicalHelper.get(TagPrefix.dust, material, 1), gemItem)
.id(`tfg:quern/${materialName}_gem_to_dust`)
// Melting
const tfcProperty = material.getProperty(TFGPropertyKey.TFC_PROPERTY);
if (tfcProperty !== null) {
addTFCMelting(event, ChemicalHelper.get(TagPrefix.gemChipped, material, 1), material, global.calcAmountOfMetalProcessed(144 / 4, tfcProperty.getPercentOfMaterial()), 'gem_chipped');
addTFCMelting(event, ChemicalHelper.get(TagPrefix.gemFlawed, material, 1), material, global.calcAmountOfMetalProcessed(144 / 2, tfcProperty.getPercentOfMaterial()), 'gem_flawed');
addTFCMelting(event, gemItem, material, global.calcAmountOfMetalProcessed(144, tfcProperty.getPercentOfMaterial()), 'gem');
addTFCMelting(event, ChemicalHelper.get(TagPrefix.gemFlawless, material, 1), material, global.calcAmountOfMetalProcessed(144 * 2, tfcProperty.getPercentOfMaterial()), 'gem_flawless');
addTFCMelting(event, ChemicalHelper.get(TagPrefix.gemExquisite, material, 1), material, global.calcAmountOfMetalProcessed(144 * 4, tfcProperty.getPercentOfMaterial()), 'gem_exquisite');
}
}

View file

@ -0,0 +1,576 @@
// priority: 0
"use strict";
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processDust(event, material) {
// Melting
const tfcProperty = material.getProperty(TFGPropertyKey.TFC_PROPERTY);
if (tfcProperty !== null) {
const tinyDust = ChemicalHelper.get(TagPrefix.dustTiny, material, 1);
addTFCMelting(event, tinyDust, material, global.calcAmountOfMetalProcessed(144 / 9, tfcProperty.getPercentOfMaterial()), 'tiny_dust');
const smallDust = ChemicalHelper.get(TagPrefix.dustSmall, material, 1);
addTFCMelting(event, smallDust, material, global.calcAmountOfMetalProcessed(144 / 4, tfcProperty.getPercentOfMaterial()), 'small_dust');
const dust = ChemicalHelper.get(TagPrefix.dust, material, 1);
addTFCMelting(event, dust, material, global.calcAmountOfMetalProcessed(144, tfcProperty.getPercentOfMaterial()), 'dust');
}
}
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processPowder(event, material) {
const powderItem = ChemicalHelper.get(TFGTagPrefix.powder, material, 1);
if (powderItem.isEmpty())
return;
const dustItem = ChemicalHelper.get(TagPrefix.dust, material, 1);
const materialName = material.getName();
event.recipes.gtceu.macerator(`tfg:${materialName}_to_powder`)
.itemInputs(dustItem)
.itemOutputs(powderItem.withCount(4))
.duration(60)
.EUt(2)
event.recipes.tfc.quern(powderItem.withCount(4), dustItem)
.id(`tfg:quern/${materialName}`)
const tfcProperty = material.getProperty(TFGPropertyKey.TFC_PROPERTY);
if (tfcProperty !== null) {
addTFCMelting(event, powderItem, material, global.calcAmountOfMetalProcessed(144 / 4, tfcProperty.getPercentOfMaterial()), 'powder');
}
if (material.hasProperty(PropertyKey.FLUID)) {
event.recipes.gtceu.extractor(`tfg:${materialName}_powder`)
.itemInputs(powderItem)
.outputFluids(Fluid.of(material.getFluid(), global.calcAmountOfMetalProcessed(144 / 4, tfcProperty.getPercentOfMaterial())))
.duration(material.getMass() / 4)
.category(GTRecipeCategories.EXTRACTOR_RECYCLING)
.EUt(getFluidRecipeEUt(material))
}
}
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processIngot(event, material) {
const ingotItem = ChemicalHelper.get(TagPrefix.ingot, material, 1);
if (ingotItem.isEmpty()
|| ingotItem.hasTag('c:hidden_from_recipe_viewers')
|| material === GTMaterials.Stone)
return;
if (material.hasProperty(TFGPropertyKey.TFC_PROPERTY)) {
addTFCMelting(event, ingotItem, material, 144, 'ingot');
addMaterialCasting(event, ingotItem, 'tfc:ceramic/ingot_mold', false, null, material, 'ingot', 144);
addMaterialCasting(event, ingotItem, 'tfc:ceramic/fire_ingot_mold', true, null, material, 'ingot', 144);
}
}
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processIngotDouble(event, material) {
if (!material.hasFlag(TFGMaterialFlags.GENERATE_DOUBLE_INGOTS))
return;
const ingotItem = ChemicalHelper.get(TagPrefix.ingot, material, 1);
const doubleIngotItem = ChemicalHelper.get(TFGTagPrefix.ingotDouble, material, 1);
addMaterialRecycling(event, doubleIngotItem, material, "double_ingot", TFGTagPrefix.ingotDouble);
addMaterialWelding(event, doubleIngotItem, ingotItem, ingotItem, material, 5, 1);
event.recipes.gtceu.bender(`tfg:bend_${material.getName()}_double_ingot_electric_only`)
.itemInputs(ingotItem.withCount(2))
.itemOutputs(doubleIngotItem)
.duration(material.getMass() * 6)
.EUt(GTValues.VA[GTValues.LV])
.circuit(3)
}
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processBlock(event, material) {
const blockItem = ChemicalHelper.get(TagPrefix.block, material, 1);
if (blockItem.isEmpty()
|| blockItem.hasTag('c:hidden_from_recipe_viewers')
|| GTMaterials.Stone === material
|| material.hasProperty(PropertyKey.POLYMER))
return;
const matAmount = getMaterialAmount(TagPrefix.block, material);
const materialName = material.getName();
if (material.hasProperty(PropertyKey.INGOT)) {
const ingotItem = ChemicalHelper.get(TagPrefix.ingot, material, 1);
let ingotArray = [];
for (let i = 0; i < matAmount; i++)
ingotArray.push(ingotItem)
event.recipes.greate.compacting(blockItem, ingotArray)
.recipeTier(1)
.circuitNumber(9)
.heated()
.id(`greate:compacting/${materialName}_block`)
}
else if (material.hasProperty(PropertyKey.GEM)) {
const gemItem = ChemicalHelper.get(TagPrefix.gem, material, 1);
let gemArray = [];
for (let i = 0; i < matAmount; i++)
gemArray.push(gemItem)
event.recipes.greate.compacting(blockItem, gemArray)
.recipeTier(1)
.circuitNumber(9)
.id(`greate:compacting/${materialName}_block`)
}
if (material.hasProperty(TFGPropertyKey.TFC_PROPERTY)) {
addTFCMelting(event, blockItem, material, 144 * matAmount, 'block');
}
}
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processPlate(event, material) {
const plateItem = ChemicalHelper.get(TagPrefix.plate, material, 1)
if (plateItem.isEmpty() || plateItem.hasTag('c:hidden_from_recipe_viewers'))
return;
const materialName = material.getName();
event.remove({ id: `gtceu:shaped/plate_${materialName}` })
if (material === GTMaterials.Stone
|| material === GTMaterials.Wood
|| material === GTMaterials.TreatedWood
|| material.hasProperty(PropertyKey.POLYMER))
return;
const tfcProperty = material.getProperty(TFGPropertyKey.TFC_PROPERTY);
if (tfcProperty !== null) {
addTFCMelting(event, plateItem, material, 144, 'plate');
const doubleIngotItem = ChemicalHelper.get(TFGTagPrefix.ingotDouble, material, 1);
addAnvilRecipe(event, plateItem, doubleIngotItem, ['hit_last', 'hit_second_last', 'hit_third_last'], false, material, 'sheet');
}
const ingotItem = ChemicalHelper.get(TagPrefix.ingot, material, 1);
if (!ingotItem.isEmpty()) {
event.custom({
type: "createaddition:rolling",
input: ingotItem,
result: plateItem,
//processingTime: material.getMass() // TODO - controlled by a global config argh
}).id(`tfg:rolling/${materialName}_plate`)
}
}
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processPlateDouble(event, material) {
const doublePlateItem = ChemicalHelper.get(TagPrefix.plateDouble, material, 1)
if (doublePlateItem.isEmpty() || doublePlateItem.hasTag('c:hidden_from_recipe_viewers'))
return;
const plateItem = ChemicalHelper.get(TagPrefix.plate, material, 1);
event.remove({ id: `gtceu:shaped/plate_double_${material.getName()}` })
if (material.hasProperty(TFGPropertyKey.TFC_PROPERTY)) {
addTFCMelting(event, doublePlateItem, material, 288, 'double_plate');
// If it's a TFC-era material, allow double plates in LV
event.remove({ id: `gtceu:bender/bend_${material.getName()}_plate_to_double_plate` })
event.recipes.gtceu.bender(`tfg:bend_${material.getName()}_plate_to_double_plate_electric_only`)
.itemInputs(plateItem.withCount(2))
.itemOutputs(doublePlateItem)
.circuit(2)
.duration(material.getMass() * 2)
.EUt(24)
}
addMaterialWelding(event, doublePlateItem, plateItem, plateItem, material, 4, 2);
}
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processFoil(event, material) {
const foilItem = ChemicalHelper.get(TagPrefix.foil, material, 4)
const plateItem = ChemicalHelper.get(TagPrefix.plate, material, 1)
if (plateItem.isEmpty() || foilItem.isEmpty() || plateItem.hasTag('c:hidden_from_recipe_viewers'))
return;
event.custom({
type: "createaddition:rolling",
input: plateItem,
result: foilItem,
// TODO - processing time is controlled by a global config instead of setting it per-recipe...
//processingTime: material.getMass()
}).id(`tfg:rolling/${material.getName()}_foil`)
}
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processRod(event, material) {
if (material === GTMaterials.Wood || material === GTMaterials.TreatedWood)
return;
// Short rods
const shortRodItem = ChemicalHelper.get(TagPrefix.rod, material, 1)
if (shortRodItem.isEmpty() || shortRodItem.hasTag('c:hidden_from_recipe_viewers'))
return;
const materialName = material.getName();
addMaterialCasting(event, shortRodItem, 'tfg:rod_mold', true, null, material, 'rod', 144 / 2);
const tfcProperty = material.getProperty(TFGPropertyKey.TFC_PROPERTY);
if (tfcProperty !== null) {
addTFCMelting(event, shortRodItem, material, 144 / 2, 'rod');
const ingotItem = ChemicalHelper.get(TagPrefix.ingot, material, 1)
addAnvilRecipe(event, shortRodItem.withCount(2), ingotItem, ['draw_last'], false, material, 'rod');
}
// Every material with a short rod also has a long rod
const longRodItem = ChemicalHelper.get(TagPrefix.rodLong, material, 1)
if (longRodItem.isEmpty() || longRodItem.hasTag('c:hidden_from_recipe_viewers'))
return;
event.remove({ id: `gtceu:shaped/stick_long_stick_${materialName}` })
if (tfcProperty !== null) {
addTFCMelting(event, longRodItem, material, 144, 'long_rod');
}
addMaterialWelding(event, longRodItem, shortRodItem, shortRodItem, material, 4, 1);
}
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processBolt(event, material) {
if (material === GTMaterials.Wood || material === GTMaterials.TreatedWood)
return;
const boltItem = ChemicalHelper.get(TagPrefix.bolt, material, 1);
if (boltItem.isEmpty())
return;
const tfcProperty = material.getProperty(TFGPropertyKey.TFC_PROPERTY);
if (tfcProperty !== null) {
addTFCMelting(event, boltItem, material, getMaterialAmount(TagPrefix.bolt, material) * 144, 'bolt');
const rodItem = ChemicalHelper.get(TagPrefix.rod, material, 1)
addAnvilRecipe(event, boltItem.withCount(4), rodItem, ['punch_last', 'draw_second_last', 'draw_third_last'], false, material, 'bolt');
}
}
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processScrew(event, material) {
if (material === GTMaterials.Wood || material === GTMaterials.TreatedWood)
return;
const screwItem = ChemicalHelper.get(TagPrefix.screw, material, 1);
if (screwItem.isEmpty())
return;
const tfcProperty = material.getProperty(TFGPropertyKey.TFC_PROPERTY);
if (tfcProperty !== null) {
addTFCMelting(event, screwItem, material, getMaterialAmount(TagPrefix.screw, material) * 144, 'screw');
const rodItem = ChemicalHelper.get(TagPrefix.rod, material, 1);
addAnvilRecipe(event, screwItem.withCount(4), rodItem, ['punch_last', 'punch_second_last', 'shrink_third_last'], false, material, 'screw');
}
}
function processRing(event, material) {
const ringItem = ChemicalHelper.get(TagPrefix.ring, material, 1)
if (ringItem.isEmpty())
return;
const tfcProperty = material.getProperty(TFGPropertyKey.TFC_PROPERTY);
if (tfcProperty !== null) {
addTFCMelting(event, ringItem, material, getMaterialAmount(TagPrefix.ring, material) * 144, 'ring');
const rodItem = ChemicalHelper.get(TagPrefix.rod, material, 1);
addAnvilRecipe(event, ringItem.withCount(2), rodItem, ['hit_last', 'hit_second_last', 'hit_third_last'], false, material, 'ring');
}
}
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processAnvil(event, material) {
const anvilItem = ChemicalHelper.get(TFGTagPrefix.anvil, material, 1)
if (anvilItem.isEmpty())
return;
addMaterialRecycling(event, anvilItem, material, 'anvil', TFGTagPrefix.anvil);
addMaterialCasting(event, anvilItem, null, false, 'gtceu:anvil_casting_mold', material, 'anvil', getMaterialAmount(TFGTagPrefix.anvil, material) * 144);
}
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processLamp(event, material) {
const finishedLampItem = ChemicalHelper.get(TFGTagPrefix.lamp, material, 1)
const unfinishedLampItem = ChemicalHelper.get(TFGTagPrefix.lampUnfinished, material, 1)
if (finishedLampItem.isEmpty() || unfinishedLampItem.isEmpty())
return;
const materialName = material.getName();
// Unfinished lamp
let matMap = { 'glass': 1 };
matMap[materialName] = 1;
TFGHelpers.registerMaterialInfo(finishedLampItem, matMap);
addTFCMelting(event, finishedLampItem, material, 144, 'lamp');
addMaterialRecycling(event, unfinishedLampItem, material, 'unfinished_lamp', TFGTagPrefix.lampUnfinished);
addMaterialCasting(event, unfinishedLampItem, null, false, 'tfg:lamp_casting_mold', material, 'unfinished_lamp', getMaterialAmount(TFGTagPrefix.lampUnfinished, material) * 144);
// Finished lamp
event.recipes.gtceu.packer(`tfg:${materialName}_lamp`)
.itemInputs("tfc:lamp_glass", unfinishedLampItem)
.itemOutputs(finishedLampItem)
.duration(100)
.EUt(GTValues.VA[GTValues.LV])
event.recipes.gtceu.fluid_solidifier(`tfg:${materialName}_lamp_from_liquid`)
.itemInputs(unfinishedLampItem)
.inputFluids(Fluid.of(GTMaterials.Glass.getFluid(), 144))
.itemOutputs(finishedLampItem)
.duration(100)
.EUt(GTValues.VA[GTValues.LV])
event.recipes.gtceu.macerator(`tfg:macerate_${materialName}_lamp`)
.itemInputs(finishedLampItem)
.itemOutputs(`#forge:dusts/${materialName}`, `#forge:dusts/glass`)
.category(GTRecipeCategories.MACERATOR_RECYCLING)
.duration(material.getMass())
.EUt(2);
event.recipes.gtceu.arc_furnace(`tfg:arc_${materialName}_lamp`)
.itemInputs(finishedLampItem)
.itemOutputs(`#forge:ingots/${materialName}`)
.category(GTRecipeCategories.ARC_FURNACE_RECYCLING)
.duration(material.getMass())
.EUt(30);
}
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processTrapdoor(event, material) {
const trapdoorItem = ChemicalHelper.get(TFGTagPrefix.trapdoor, material, 1)
if (trapdoorItem.isEmpty())
return;
addMaterialRecycling(event, trapdoorItem, material, 'trapdoor', TFGTagPrefix.trapdoor);
addMaterialCasting(event, trapdoorItem, null, false, 'tfg:trapdoor_casting_mold', material, 'trapdoor', getMaterialAmount(TFGTagPrefix.trapdoor, material) * 144);
if (material.hasProperty(TFGPropertyKey.TFC_PROPERTY)) {
const plateItem = ChemicalHelper.get(TagPrefix.plate, material, 1);
addAnvilRecipe(event, trapdoorItem, plateItem, ['bend_last', 'draw_second_last', 'draw_third_last'], false, material, 'trapdoor');
}
}
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processBell(event, material) {
const bellItem = ChemicalHelper.get(TFGTagPrefix.bell, material, 1)
if (bellItem.isEmpty())
return;
const materialName = material.getName();
event.remove({ id: `tfc:heating/${materialName}_bell` })
addMaterialRecycling(event, bellItem, material, 'bell', TFGTagPrefix.bell);
addMaterialCasting(event, bellItem, 'tfc:ceramic/bell_mold', false, 'tfg:bell_casting_mold', material, 'bell', getMaterialAmount(TFGTagPrefix.bell, material) * 144);
}
function processChain(event, material) {
const chainItem = ChemicalHelper.get(TFGTagPrefix.chain, material, 1);
if (chainItem.isEmpty())
return;
addMaterialRecycling(event, chainItem, material, 'chain', TFGTagPrefix.chain);
addMaterialCasting(event, chainItem.withCount(16), null, false, 'tfg:chain_casting_mold', material, 'chain', 144);
}
function processBars(event, material) {
const barsItem = ChemicalHelper.get(TFGTagPrefix.bars, material, 1);
if (barsItem.isEmpty())
return;
addMaterialRecycling(event, barsItem, material, 'bars', TFGTagPrefix.bars);
const ingotItem = ChemicalHelper.get(TagPrefix.ingot, material, 1);
event.stonecutting(barsItem.withCount(4), ingotItem);
if (material.hasProperty(TFGPropertyKey.TFC_PROPERTY)) {
addAnvilRecipe(event, barsItem.withCount(4), ingotItem, ['upset_last', 'punch_second_last', 'punch_third_last'], false, material, 'bars');
const doubleIngotItem = ChemicalHelper.get(TFGTagPrefix.ingotDouble, material, 1);
addAnvilRecipe(event, barsItem.withCount(8), doubleIngotItem, ['upset_last', 'punch_second_last', 'punch_third_last'], false, material, 'bars_double');
}
}
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processBuzzsawBlade(event, material) {
const buzzsawBladeItem = ChemicalHelper.get(TagPrefix.toolHeadBuzzSaw, material, 1)
const doublePlateItem = ChemicalHelper.get(TagPrefix.plateDouble, material, 1)
if (buzzsawBladeItem.isEmpty() || doublePlateItem.isEmpty())
return;
const tfcProperty = material.getProperty(TFGPropertyKey.TFC_PROPERTY);
const materialName = material.getName();
event.recipes.gtceu.lathe(`buzzsaw_gear_${materialName}`)
.itemInputs(doublePlateItem)
.itemOutputs(buzzsawBladeItem)
.duration(material.getMass() * 6)
.EUt(GTValues.VA[tfcProperty !== null ? GTValues.LV : GTValues.MV])
if (tfcProperty !== null) {
addAnvilRecipe(event, buzzsawBladeItem, doublePlateItem, ['bend_last', 'hit_second_last', 'draw_third_last'], false, material, 'buzzsaw_blade');
event.recipes.vintageimprovements.polishing(buzzsawBladeItem, doublePlateItem)
.speedLimits(0)
.processingTime(material.getMass() * global.VINTAGE_IMPROVEMENTS_DURATION_MULTIPLIER)
.id(`tfg:vi/lathe/${materialName}_buzzsaw`)
}
addMaterialRecycling(event, buzzsawBladeItem, material, 'buzz_saw_blade', TagPrefix.toolHeadBuzzSaw);
event.remove({ id: `gtceu:shaped/buzzsaw_blade_${materialName}` })
}
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processSpring(event, material) {
const springItem = ChemicalHelper.get(TagPrefix.spring, material, 1);
const materialName = material.getName();
const tfcProperty = material.getProperty(TFGPropertyKey.TFC_PROPERTY);
if (springItem !== null) {
event.remove({ id: `gtceu:shaped/spring_${materialName}` });
if (tfcProperty !== null) {
addTFCMelting(event, springItem, material, getMaterialAmount(TagPrefix.spring, material) * 144, 'spring');
const longRodItem = ChemicalHelper.get(TagPrefix.rodLong, material, 1);
addAnvilRecipe(event, springItem, longRodItem, ['hit_last', 'bend_second_last', 'bend_third_last'], false, material, 'spring');
}
}
const smallSpringItem = ChemicalHelper.get(TagPrefix.springSmall, material, 1);
if (smallSpringItem !== null) {
event.remove({ id: `gtceu:shaped/spring_small_${materialName}` });
if (tfcProperty !== null) {
addTFCMelting(event, smallSpringItem, material, getMaterialAmount(TagPrefix.springSmall, material) * 144, 'spring_small');
const rodItem = ChemicalHelper.get(TagPrefix.rod, material, 1);
addAnvilRecipe(event, smallSpringItem, rodItem, ['hit_last', 'bend_second_last', 'bend_third_last'], false, material, 'small_spring');
}
}
}
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processNugget(event, material) {
const nuggetItem = ChemicalHelper.get(TagPrefix.nugget, material, 1);
if (nuggetItem.isEmpty())
return;
const tfcProperty = material.getProperty(TFGPropertyKey.TFC_PROPERTY)
if (tfcProperty !== null) {
addTFCMelting(event, nuggetItem, material, 144 / 9, 'nugget');
addMaterialCasting(event, nuggetItem.withCount(4), 'tfg:nugget_mold', false, null, material, 'nugget', 144 * (4/9));
const ingotItem = ChemicalHelper.get(TagPrefix.ingot, material, 1);
addAnvilRecipe(event, nuggetItem.withCount(9), ingotItem, ['punch_last', 'hit_second_last', 'punch_third_last'], false, material, 'nugget');
}
}
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processSmallGear(event, material) {
const smallGearItem = ChemicalHelper.get(TagPrefix.gearSmall, material, 1);
if (smallGearItem.isEmpty())
return;
const tfcProperty = material.getProperty(TFGPropertyKey.TFC_PROPERTY)
if (tfcProperty !== null) {
addTFCMelting(event, smallGearItem, material, 144, 'small_gear');
addMaterialCasting(event, smallGearItem, 'tfg:small_gear_mold', true, null, material, 'small_gear', 144);
const ingotItem = ChemicalHelper.get(TagPrefix.ingot, material, 1);
addAnvilRecipe(event, smallGearItem, ingotItem, ['hit_last', 'shrink_second_last', 'draw_third_last'], false, material, 'small_gear');
}
}
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processLargeGear(event, material) {
const gearItem = ChemicalHelper.get(TagPrefix.gear, material, 1);
if (gearItem.isEmpty())
return;
const tfcProperty = material.getProperty(TFGPropertyKey.TFC_PROPERTY)
if (tfcProperty !== null) {
addTFCMelting(event, gearItem, material, 144 * 4, 'gear');
let doublePlateItem = ChemicalHelper.get(TagPrefix.plateDouble, material, 1)
addMaterialWelding(event, gearItem, doublePlateItem, doublePlateItem, material, 4, 1);
}
}

View file

@ -0,0 +1,298 @@
// priority: 0
"use strict";
/**
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processTFCArmor(event, material) {
const materialName = material.getName();
const plateItem = ChemicalHelper.get(TagPrefix.plate, material, 1);
const doublePlateItem = ChemicalHelper.get(TagPrefix.plateDouble, material, 1);
// Helmet
const unfinishedHelmet = `tfc:metal/unfinished_helmet/${materialName}`;
const finishedHelmet = `tfc:metal/helmet/${materialName}`;
addAnvilRecipe(event, unfinishedHelmet, doublePlateItem, ['hit_last', 'bend_second_last', 'bend_third_last'], true, material, 'unfinished_helmet');
addTFCMelting(event, unfinishedHelmet, material, 144 * 2, 'unfinished_helmet');
addTFCMelting(event, finishedHelmet, material, 144 * 3, 'helmet');
addMaterialWelding(event, finishedHelmet, unfinishedHelmet, plateItem, material, 4, 0);
// Chestplate
const unfinishedChestplate = `tfc:metal/unfinished_chestplate/${materialName}`;
const finishedChestplate = `tfc:metal/chestplate/${materialName}`;
addAnvilRecipe(event, unfinishedChestplate, doublePlateItem, ['hit_last', 'hit_second_last', 'upset_third_last'], true, material, 'unfinished_chestplate');
addTFCMelting(event, unfinishedChestplate, material, 144 * 2, 'unfinished_chestplate');
addTFCMelting(event, finishedChestplate, material, 144 * 4, 'chestplate');
addMaterialWelding(event, finishedChestplate, unfinishedChestplate, doublePlateItem, material, 4, 0);
// Greaves
const unfinishedGreaves = `tfc:metal/unfinished_greaves/${materialName}`;
const finishedGreaves = `tfc:metal/greaves/${materialName}`;
addAnvilRecipe(event, unfinishedGreaves, doublePlateItem, ['bend_any', 'draw_any', 'hit_any'], true, material, 'unfinished_greaves');
addTFCMelting(event, unfinishedGreaves, material, 144 * 2, 'unfinished_greaves');
addTFCMelting(event, finishedGreaves, material, 144 * 3, 'greaves');
addMaterialWelding(event, finishedGreaves, unfinishedGreaves, plateItem, material, 4, 0);
// Boots
const unfinishedBoots = `tfc:metal/unfinished_boots/${materialName}`;
const finishedBoots = `tfc:metal/boots/${materialName}`;
addAnvilRecipe(event, unfinishedBoots, plateItem, ['bend_last', 'bend_second_last', 'shrink_third_last'], true, material, 'unfinished_boots');
addTFCMelting(event, unfinishedBoots, material, 144, 'unfinished_boots');
addTFCMelting(event, finishedBoots, material, 144 * 2, 'boots');
addMaterialWelding(event, finishedBoots, unfinishedBoots, plateItem, material, 4, 0);
}
/**
* Processes the TFC items for the TFC "tool material" metals
* @param {Internal.RecipesEventJS} event
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processTFCTool(event, material) {
const materialName = material.getName();
const ingotItem = ChemicalHelper.get(TagPrefix.ingot, material, 1);
const doubleIngotItem = ChemicalHelper.get(TFGTagPrefix.ingotDouble, material, 1);
const doublePlateItem = ChemicalHelper.get(TagPrefix.plateDouble, material, 1);
const knifeHead = ChemicalHelper.get(TFGTagPrefix.toolHeadKnife, material, 1)
// Helper methods
function addExtruderRecipe(outputItem, inputItem, mold, id) {
event.recipes.vintageimprovements.curving(outputItem, inputItem)
.head(mold)
.id(`tfg:vi/curving/${materialName}_${id}`)
event.recipes.gtceu.extruder(`tfg:${materialName}_${id}`)
.itemInputs(inputItem)
.notConsumable(mold)
.itemOutputs(outputItem)
.duration(material.getMass() * 6)
.EUt(GTValues.VA[GTValues.LV])
}
// For tools that are pure TFC
if (material.hasFlag(TFGMaterialFlags.HAS_TFC_TOOL)) {
// Tuyere
let tuyere = `tfc:metal/tuyere/${materialName}`;
addTFCMelting(event, tuyere, material, 144 * 2, 'tuyere');
addExtruderRecipe(tuyere, doublePlateItem, 'gtceu:bottle_extruder_mold', 'tuyere');
addAnvilRecipe(event, tuyere, doublePlateItem, ['bend_last', 'bend_second_last'], true, material, 'tuyere');
// Shield
let shield = `tfc:metal/shield/${materialName}`;
addTFCMelting(event, shield, material, 144 * 2, 'shield');
addExtruderRecipe(shield, doublePlateItem, 'gtceu:plate_extruder_mold', 'shield');
addAnvilRecipe(event, shield, doublePlateItem, ['upset_last', 'bend_second_last', 'bend_third_last'], true, material, 'shield');
// Horse armor
let horseArmor = `tfc:metal/horse_armor/${materialName}`;
addTFCMelting(event, horseArmor, material, 144 * 6, 'horse_armor');
// Fish hook
let fishHook = `tfc:metal/fish_hook/${materialName}`;
addAnvilRecipe(event, fishHook, ingotItem, ['bend_any', 'hit_any', 'draw_not_last'], false, material, 'fish_hook');
addTFCMelting(event, `tfc:metal/fishing_rod/${materialName}`, material, 144, 'fishing_rod');
// Mace
let mace = `tfc:metal/mace/${materialName}`;
addTFCMelting(event, mace, material, 144 * 2, 'mace');
// Mattock
event.remove({ id: `rnr:heating/metal/${materialName}_mattock` })
event.remove({ id: `rnr:heating/metal/${materialName}_mattock_head` })
let mattock = `rnr:metal/mattock/${materialName}`;
addTFCMelting(event, mattock, material, 144, 'mattock');
// Shears
let shears = `tfc:metal/shears/${materialName}`;
addMaterialWelding(event, shears, knifeHead, knifeHead, material, 4, 1);
addTFCMelting(event, shears, material, 144 * 2, 'shears');
event.recipes.gtceu.forge_hammer(`tfg:shears/${materialName}`)
.itemInputs(knifeHead.withCount(2))
.itemOutputs(shears)
.duration(40)
.EUt(7);
// Prospector pick
let propick = `tfc:metal/propick/${materialName}`;
addTFCMelting(event, propick, material, 144, 'propick');
// Chisel
let chisel = `tfc:metal/chisel/${materialName}`;
addTFCMelting(event, chisel, material, 144, 'chisel');
// Javelin
let javelin = `tfc:metal/javelin/${materialName}`;
addTFCMelting(event, javelin, material, 144, 'javelin');
// Scraping knife
let scrapingKnife = `tfcscraping:metal/scraping_knife/${materialName}`;
let scrapingKnifeBlade = `tfcscraping:metal/scraping_knife_blade/${materialName}`;
addAnvilRecipe(event, scrapingKnifeBlade, doubleIngotItem, ['hit_last','draw_not_last', 'draw_second_last'], true, material, 'scraping_knife_blade');
addTFCMelting(event, scrapingKnife, material, 144 * 2, 'scraping_knife');
addMaterialRecyclingNoTagPrefix(event, scrapingKnifeBlade, material, 'scraping_knife_blade', 2);
addMaterialCasting(event, scrapingKnifeBlade, 'tfcscraping:ceramic/scraping_knife_blade_mold', false, null, material, 'scraping_knife_blade', 144 * 2);
// Tongs
let tongPart = `tfchotornot:tong_part/${materialName}`;
let tong = `tfchotornot:tongs/${materialName}`;
addExtruderRecipe(tongPart, ChemicalHelper.get(TagPrefix.rodLong, material, 1), 'gtceu:rod_extruder_mold', 'tong_part');
addMaterialRecyclingNoTagPrefix(event, tongPart, material, 'tong_part', 1);
addTFCMelting(event, tong, material, 144 * 2, 'tong');
event.recipes.tfc.advanced_shaped_crafting(
TFC.isp.of(tong).copyForgingBonus(), [
'AA',
'BC'
], {
A: tongPart,
B: Ingredient.of('#forge:bolts').subtract('gtceu:wood_bolt'),
C: '#forge:tools/hammers'
}, 0, 0).id(`tfchotornot:crafting/tongs/${materialName}`)
event.recipes.gtceu.forge_hammer(tong)
.itemInputs(`2x ${tongPart}`)
.itemOutputs(tong)
.duration(material.getMass())
.EUt(GTValues.VA[GTValues.ULV])
event.remove({ id: `tfchotornot:heating/tongs/${materialName}` })
event.remove({ id: `tfchotornot:heating/tong_part/${materialName}` })
}
// Sword
const swordBlade = ChemicalHelper.get(TFGTagPrefix.toolHeadSword, material, 1);
event.remove({ id: `tfc:crafting/metal/sword/${materialName}` })
addAnvilRecipe(event, swordBlade, doubleIngotItem, ['punch_last', 'bend_not_last', 'draw_not_last'], true, material, 'sword_blade');
// Butchery Knife
const butcheryKnifeHead = ChemicalHelper.get(TFGTagPrefix.toolHeadButcheryKnife, material, 1);
addAnvilRecipe(event, butcheryKnifeHead, ingotItem, ['punch_last', 'bend_not_last', 'bend_not_last'], true, material, 'knife_butchery_head');
// Mining Hammer
const miningHammerHead = ChemicalHelper.get(TFGTagPrefix.toolHeadMiningHammer, material, 1);
addAnvilRecipe(event, miningHammerHead, doubleIngotItem, ['punch_last', 'shrink_not_last'], true, material, 'mining_hammer_head');
// Spade
const spadeHead = ChemicalHelper.get(TFGTagPrefix.toolHeadSpade, material, 1);
addAnvilRecipe(event, spadeHead, doubleIngotItem, ['punch_last', 'hit_not_last'], true, material, 'spade_head');
// Pickaxe
const pickaxeHead = ChemicalHelper.get(TFGTagPrefix.toolHeadPickaxe, material, 1);
event.remove({ id: `tfc:crafting/metal/pickaxe/${materialName}` });
addAnvilRecipe(event, pickaxeHead, ingotItem, ['punch_last', 'bend_not_last', 'draw_not_last'], true, material, 'pickaxe_head');
// Screwdriver
const screwdriverHead = ChemicalHelper.get(TagPrefix.toolHeadScrewdriver, material, 1);
addAnvilRecipe(event, screwdriverHead, ingotItem, ['draw_last', 'hit_second_last', 'hit_third_last'], true, material, 'screwdriver_tip');
// Wrench
const wrenchHead = ChemicalHelper.get(TagPrefix.toolHeadWrench, material, 1);
addAnvilRecipe(event, wrenchHead, doubleIngotItem, ['draw_last', 'hit_second_last', 'hit_third_last'], true, material, 'wrench_tip');
// Crowbar
const crowbar = ToolHelper.get(GTToolType.CROWBAR, material);
addTFCMelting(event, crowbar, material, 144 * 1.5, 'crowbar');
// Wire cutters
const wireCutterHead = ChemicalHelper.get(TagPrefix.toolHeadWireCutter, material, 1);
addAnvilRecipe(event, wireCutterHead, doubleIngotItem, ['draw_last', 'hit_second_last', 'hit_third_last'], true, material, 'wire_cutter_head');
// Axe
const axeHead = ChemicalHelper.get(TFGTagPrefix.toolHeadAxe, material, 1);
event.remove({ id: `tfc:crafting/metal/axe/${materialName}` });
addAnvilRecipe(event, axeHead, ingotItem, ['punch_last', 'hit_second_last', 'upset_third_last'], true, material, 'axe_head');
// Shovel
const shovelHead = ChemicalHelper.get(TFGTagPrefix.toolHeadShovel, material, 1);
event.remove({ id: `tfc:crafting/metal/shovel/${materialName}` });
addAnvilRecipe(event, shovelHead, ingotItem, ['punch_last', 'hit_not_last'], true, material, 'shovel_head');
// Hoe
const hoeHead = ChemicalHelper.get(TFGTagPrefix.toolHeadHoe, material, 1);
event.remove({ id: `tfc:crafting/metal/hoe/${materialName}` });
addAnvilRecipe(event, hoeHead, ingotItem, ['punch_last', 'hit_not_last', 'bend_not_last'], true, material, 'hoe_head');
// Hammer
const hammerHead = ChemicalHelper.get(TFGTagPrefix.toolHeadHammer, material, 1);
event.remove({ id: `tfc:crafting/metal/hammer/${materialName}` });
addAnvilRecipe(event, hammerHead, ingotItem, ['punch_last', 'shrink_not_last'], true, material, 'hammer_head');
// Saw
const sawHead = ChemicalHelper.get(TFGTagPrefix.toolHeadSaw, material, 1);
event.remove({ id: `tfc:crafting/metal/saw/${materialName}` });
addAnvilRecipe(event, sawHead, ingotItem, ['hit_last', 'hit_second_last'], true, material, 'saw_blade');
// Scythe
const scytheHead = ChemicalHelper.get(TFGTagPrefix.toolHeadScythe, material, 1);
event.remove({ id: `tfc:crafting/metal/scythe/${materialName}` })
addAnvilRecipe(event, scytheHead, ingotItem, ['punch_last', 'bend_not_last', 'draw_not_last'], true, material, 'scythe_blade');
// File
const fileHead = ChemicalHelper.get(TFGTagPrefix.toolHeadFile, material, 1);
addAnvilRecipe(event, fileHead, ingotItem, ['upset_last', 'bend_not_last', 'punch_not_last'], true, material, 'file_head');
// Knife
addAnvilRecipe(event, knifeHead, ingotItem, ['punch_last', 'bend_not_last', 'draw_not_last'], true, material, 'knife_blade');
}
/**
* @param {Internal.RecipesEventJS} event
* @param {GTMaterial} material
*/
function processPlatedBlock(event, material) {
const platedBlock = ChemicalHelper.get(TFGTagPrefix.blockPlated, material, 1);
if (platedBlock === null)
return;
const platedSlab = ChemicalHelper.get(TFGTagPrefix.slabPlated, material, 1);
const platedStair = ChemicalHelper.get(TFGTagPrefix.stairPlated, material, 1);
const plateItem = ChemicalHelper.get(TagPrefix.plate, material, 1);
const materialName = material.getName();
event.shapeless(platedBlock, ['#forge:stone_bricks', plateItem, '#forge:tools/hammers'])
.id(`tfg:shapeless/${materialName}_plated_block`)
event.recipes.gtceu.assembler(`tfg:${materialName}_plated_block`)
.itemInputs('#forge:stone_bricks', plateItem)
.itemOutputs(platedBlock)
.circuit(10)
.duration(50)
.EUt(GTValues.VA[GTValues.ULV])
addMaterialRecycling(event, platedBlock, material, 'plated_block', TFGTagPrefix.blockPlated);
event.shapeless(platedSlab.withCount(2), ['2x #tfg:brick_slabs', plateItem, '#forge:tools/hammers'])
.id(`tfg:item_application/${materialName}_plated_slab`)
event.recipes.gtceu.assembler(`tfg:${materialName}_plated_slab`)
.itemInputs('2x #tfg:brick_slabs', plateItem)
.itemOutputs(platedSlab.withCount(2))
.circuit(10)
.duration(50)
.EUt(GTValues.VA[GTValues.ULV])
addMaterialRecycling(event, platedSlab, material, 'plated_slab', TFGTagPrefix.slabPlated);
event.shapeless(platedStair, ['#tfg:brick_stairs', plateItem, '#forge:tools/hammers'])
.id(`tfg:item_application/${materialName}_plated_stair`)
event.recipes.gtceu.assembler(`tfg:${materialName}_plated_stair`)
.itemInputs('#tfg:brick_stairs', plateItem)
.itemOutputs(platedStair)
.circuit(10)
.duration(50)
.EUt(GTValues.VA[GTValues.ULV])
addMaterialRecycling(event, platedStair, material, 'plated_stair', TFGTagPrefix.stairPlated);
}

View file

@ -0,0 +1,186 @@
// priority: 0
"use strict";
/**
* @param {Internal.RecipesEventJS} event
* @param {GTToolType} toolType
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processToolMortar(event, toolType, material) {
const toolItem = ToolHelper.get(toolType, material)
if (toolItem.isEmpty())
return;
const usableItem = ChemicalHelper.get(TagPrefix.ingot, material, 1)
if (usableItem.isEmpty())
return;
event.recipes.tfc.damage_inputs_shaped_crafting(
event.shaped(toolItem, [
'CA ',
' B '
], {
A: usableItem,
B: '#tfc:rock/raw',
C: '#tfc:chisels'
})
).id(`gtceu:shaped/mortar_${material.getName()}`);
const tfcProperty = material.getProperty(TFGPropertyKey.TFC_PROPERTY)
if (tfcProperty !== null) {
addTFCMelting(event, toolItem, material, 144, 'mortar');
}
}
/**
* @param {Internal.RecipesEventJS} event
* @param {GTToolType} toolType
* @param {String} tagPrefixName
* @param {TagPrefix} headTagPrefix
* @param {Internal.ItemStack} extruderMold
* @param {Internal.ItemStack} ceramicMold
* @param {number} circuitMeta
* Used for the laser engraver recipes for gem tools.
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processGTToolHead(event, toolType, tagPrefixName, headTagPrefix, extruderMold, ceramicMold, circuitMeta, material) {
const toolItem = ToolHelper.get(toolType, material);
const toolHeadItem = ChemicalHelper.get(headTagPrefix, material, 1);
if (toolItem.isEmpty() || toolHeadItem.isEmpty())
return;
// Skip this one because it has a duping bug, and you can't remove the macerator/arc furnace iron pick recipes
if (material === GTMaterials.Iron)
return;
const materialName = material.getName();
if (toolType === GTToolType.WRENCH) {
event.recipes.tfc.advanced_shaped_crafting(
TFC.itemStackProvider.of(toolItem).copyForgingBonus().copyHeat(), [
'ABC',
'DB '
], {
A: toolHeadItem,
B: `#forge:rods/${materialName}`,
C: '#forge:tools/screwdrivers',
D: `#forge:bolts/${materialName}`
}, 0, 0)
.id(`gtceu:shaped/${toolType.name}_${materialName}`);
} else if (toolType === GTToolType.WIRE_CUTTER) {
event.recipes.tfc.advanced_shaped_crafting(
TFC.itemStackProvider.of(toolItem).copyForgingBonus().copyHeat(), [
' AD',
'CBC'
], {
A: toolHeadItem,
B: `#forge:small_springs`,
C: `#forge:rods/${materialName}`,
D: '#forge:tools/screwdrivers'
}, 0, 1)
.id(`gtceu:shaped/${toolType.name}_${materialName}`);
} else {
event.recipes.tfc.advanced_shapeless_crafting(
TFC.itemStackProvider.of(toolItem).copyForgingBonus().copyHeat(),
[toolHeadItem, '#forge:rods/wooden'],
toolHeadItem
)
.id(`gtceu:shaped/${toolType.name}_${materialName}`);
}
const tfcProperty = material.getProperty(TFGPropertyKey.TFC_PROPERTY)
if (tfcProperty !== null) {
const materialAmount = getMaterialAmount(headTagPrefix, material);
addTFCMelting(event, toolItem, material, materialAmount * 144, toolType.name);
}
processToolHead(event, headTagPrefix, tagPrefixName, extruderMold, ceramicMold, circuitMeta, material);
}
/**
* @param {Internal.RecipesEventJS} event
* @param {TagPrefix} headTagPrefix
* @param {String} tagPrefixName
* @param {Internal.ItemStack} extruderMold
* @param {Internal.ItemStack} ceramicMold
* @param {number} circuitMeta
* Used for the laser engraver recipes for gem tools.
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function processToolHead(event, headTagPrefix, tagPrefixName, extruderMold, ceramicMold, circuitMeta, material) {
const toolHeadItem = ChemicalHelper.get(headTagPrefix, material, 1);
if (toolHeadItem.isEmpty())
return;
event.remove({ mod: 'gtceu', type: 'minecraft:crafting_shaped', output: toolHeadItem })
const materialName = material.getName();
const materialAmount = getMaterialAmount(headTagPrefix, material);
// Metal-based tools
if (material.hasProperty(PropertyKey.INGOT)) {
const ingotItem = ChemicalHelper.get(TagPrefix.ingot, material, 1);
if (ingotItem.hasTag('c:hidden_from_recipe_viewers'))
return
event.recipes.gtceu.extruder(`tfg:extrude_${materialName}_ingot_to_${tagPrefixName}`)
.itemInputs(ingotItem.copyWithCount(materialAmount))
.notConsumable(extruderMold)
.itemOutputs(toolHeadItem)
.duration(material.getMass() * 6)
.EUt(GTValues.VA[GTValues.LV])
let input_array = [];
for (let i = 0; i < materialAmount; i++) {
input_array.push(ingotItem);
}
event.recipes.vintageimprovements.curving(toolHeadItem, input_array)
.head(extruderMold)
.id(`tfg:vi/curving/${materialName}_ingot_to_${tagPrefixName}`)
if (material.hasFlag(TFGMaterialFlags.CAN_BE_UNMOLDED) && ceramicMold !== null) {
addMaterialCasting(event, toolHeadItem, ceramicMold, false, null, material, tagPrefixName, materialAmount * 144);
}
}
// Gem tools
else if (material.hasProperty(PropertyKey.GEM)) {
const gemItem = ChemicalHelper.get(TagPrefix.gem, material, materialAmount)
if (gemItem.isEmpty() || gemItem.hasTag('c:hidden_from_recipe_viewers'))
return
event.recipes.gtceu.laser_engraver(`tfg:engrave_${materialName}_gem_to_${tagPrefixName}`)
.itemInputs(gemItem)
.notConsumable(ChemicalHelper.get(TagPrefix.lens, GTMaterials.Glass, 1))
.circuit(circuitMeta)
.itemOutputs(toolHeadItem)
.duration(material.getMass() * 6)
.EUt(GTValues.VA[GTValues.LV])
}
addMaterialRecycling(event, toolHeadItem, material, tagPrefixName, headTagPrefix);
}
/**
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function modifyRecyclingAmounts(material) {
TagPrefix.toolHeadWrench.modifyMaterialAmount(material, 2);
TagPrefix.toolHeadBuzzSaw.modifyMaterialAmount(material, 2);
TagPrefix.toolHeadScrewdriver.modifyMaterialAmount(material, 1);
TagPrefix.toolHeadWireCutter.modifyMaterialAmount(material, 2);
TFGTagPrefix.toolHeadSword.modifyMaterialAmount(material, 2);
TFGTagPrefix.toolHeadButcheryKnife.modifyMaterialAmount(material, 1);
TFGTagPrefix.toolHeadMiningHammer.modifyMaterialAmount(material, 2);
TFGTagPrefix.toolHeadSpade.modifyMaterialAmount(material, 2);
TFGTagPrefix.toolHeadPickaxe.modifyMaterialAmount(material, 1);
TFGTagPrefix.toolHeadAxe.modifyMaterialAmount(material, 1);
TFGTagPrefix.toolHeadShovel.modifyMaterialAmount(material, 1);
TFGTagPrefix.toolHeadHoe.modifyMaterialAmount(material, 1);
TFGTagPrefix.toolHeadHammer.modifyMaterialAmount(material, 1);
TFGTagPrefix.toolHeadSaw.modifyMaterialAmount(material, 1);
TFGTagPrefix.toolHeadFile.modifyMaterialAmount(material, 1);
TFGTagPrefix.toolHeadKnife.modifyMaterialAmount(material, 1);
}

View file

@ -1,28 +1,352 @@
// priority: 0
// priority: 0
"use strict";
//function getMaterialRecyclingExtractorEUt(material) {
// // Special case for bis/black bronze because removing the blast property doesn't change the tier of
// // the extractor recipes retroactively
// return material.hasProperty(PropertyKey.BLAST) && material !== GTMaterials.BismuthBronze && material !== GTMaterials.BlackBronze
// ? GTValues.VA[GTValues.MV]
// : GTValues.VA[GTValues.LV];
//}
//function addMaterialRecycling(event, item, materialMap) {
/**
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
*/
function getFluidRecipeEUt(material) {
// Special case for bis/black bronze because removing the blast property doesn't change the tier of
// the extractor recipes retroactively
return material.hasProperty(PropertyKey.BLAST) && material !== GTMaterials.BismuthBronze && material !== GTMaterials.BlackBronze
? GTValues.VA[GTValues.MV]
: GTValues.VA[GTValues.LV];
}
// const tfcProperty = material.getProperty(TFGPropertyKey.TFC_PROPERTY);
// if (tfcProperty !== null) {
// const outputMaterial = (tfcProperty.getOutputMaterial() === null) ? material : tfcProperty.getOutputMaterial();
/**
* @param {TagPrefix} tagPrefix
*/
function getMaterialAmount(tagPrefix, material) {
return tagPrefix.getMaterialAmount(material) / GTValues.M;
}
// event.recipes.tfc.heating(ingotItem, tfcProperty.getMeltTemp())
// .resultFluid(Fluid.of(outputMaterial.getFluid(), 144))
// .id(`tfc:heating/metal/${material.getName()}_ingot`)
// }
//}
/**
* @param {Internal.RecipesEventJS} event
* @param {Internal.ItemStack} inputItem
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
* @param {number} mbAmount
* @param {String} recipeIdSuffix
*/
function addTFCMelting(event, inputItem, material, mbAmount, recipeIdSuffix) {
const tfcProperty = material.getProperty(TFGPropertyKey.TFC_PROPERTY);
const outputMaterial = (tfcProperty.getOutputMaterial() === null) ? material : tfcProperty.getOutputMaterial();
if (!outputMaterial.hasProperty(PropertyKey.FLUID))
return;
event.recipes.tfc.heating(inputItem, tfcProperty.getMeltTemp())
.resultFluid(Fluid.of(outputMaterial.getFluid(), mbAmount))
.useDurability(true)
.id(`tfg:heating/metal/${material.getName()}_${recipeIdSuffix}`);
}
/**
* @param {Internal.RecipesEventJS} event
* @param {Internal.ItemStack} outputItem
* @param {Internal.ItemStack} inputItem
* @param {String[]} steps
* @param {boolean} bonus
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
* @param {String} recipeIdSuffix
*/
function addAnvilRecipe(event, outputItem, inputItem, steps, bonus, material, recipeIdSuffix) {
const tfcProperty = material.getProperty(TFGPropertyKey.TFC_PROPERTY);
event.recipes.tfc.anvil(outputItem, inputItem, steps)
.tier(tfcProperty.getTier())
.bonus(bonus)
.id(`tfc:anvil/${material.getName()}_${recipeIdSuffix}`);
}
/**
* @param {Internal.RecipesEventJS} event
* @param {Internal.ItemStack} inputItem
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
* @param {String} tagPrefixName
* @param {TagPrefix} tagPrefix
*/
function addMaterialRecycling(event, inputItem, material, tagPrefixName, tagPrefix) {
const ingotAmount = getMaterialAmount(tagPrefix, material);
addMaterialRecyclingNoTagPrefix(event, inputItem, material, tagPrefixName, ingotAmount);
}
/**
* @param {Internal.RecipesEventJS} event
* @param {Internal.ItemStack} inputItem
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
* @param {String} recipeSuffix
* @param {number} ingotAmount
*/
function addMaterialRecyclingNoTagPrefix(event, inputItem, material, recipeSuffix, ingotAmount) {
const materialName = material.getName();
const mbAmount = ingotAmount * 144;
if (material.hasProperty(PropertyKey.FLUID)) {
if (material.hasProperty(TFGPropertyKey.TFC_PROPERTY)) {
addTFCMelting(event, inputItem, material, mbAmount, recipeSuffix);
}
// Add an extractor recipe
event.recipes.gtceu.extractor(`gtceu:extract_${materialName}_${recipeSuffix}`)
.itemInputs(inputItem)
.outputFluids(Fluid.of(material.getFluid(), mbAmount))
.category(GTRecipeCategories.EXTRACTOR_RECYCLING)
.duration(material.getMass() * ingotAmount)
.EUt(getFluidRecipeEUt(material));
}
// Remove existing macerator recipes because Greate
removeMaceratorRecipe(event, `macerate_${materialName}_${recipeSuffix}`);
const maceratorOutput = ChemicalHelper.getDust(material, GTValues.M * ingotAmount);
if (!maceratorOutput.isEmpty()) {
event.recipes.gtceu.macerator(`tfg:macerate_${materialName}_${recipeSuffix}`)
.itemInputs(inputItem)
.itemOutputs(maceratorOutput)
.category(GTRecipeCategories.MACERATOR_RECYCLING)
.duration(material.getMass() * ingotAmount)
.EUt(2);
}
const arcOutput = ChemicalHelper.getIngot(material, GTValues.M * ingotAmount);
if (!arcOutput.isEmpty()) {
event.recipes.gtceu.arc_furnace(`tfg:arc_${materialName}_${recipeSuffix}`)
.itemInputs(inputItem)
.itemOutputs(arcOutput)
.category(GTRecipeCategories.ARC_FURNACE_RECYCLING)
.duration(material.getMass() * ingotAmount)
.EUt(30);
}
let matmap = {};
matmap[materialName] = ingotAmount;
TFGHelpers.registerMaterialInfo(inputItem, matmap);
}
/**
* Function to get fluid filling NBT.
*
* @param {string} material
* Fluid
* @param {number} amount
* mB
* @returns {{ tank: { FluidName: string; Amount: number; }; }}
*/
const getFillingNBT = (material, amount) => {
return {
tank: {
FluidName: Fluid.of(material.getFluid()).getId(),
Amount: amount
}
}
}
/**
* @param {Internal.RecipesEventJS} event
* @param {Internal.ItemStack} outputItem
* @param {String} ceramicMold
* @param {boolean} isFireMold
* @param {String} gtMold
* The mold item for the fluid solidifier/alloy smelter.
* Pass null for built-in GT molds, since GT already generates recipes for those
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
* @param {String} tagPrefixName
* @param {number} mbAmount
*/
function addMaterialCasting(event, outputItem, ceramicMold, isFireMold, gtMold, material, tagPrefixName, mbAmount) {
const materialName = material.getName();
// If it's a TFC material, add ceramic mold casting + create spouting
const tfcProperty = material.getProperty(TFGPropertyKey.TFC_PROPERTY);
if (tfcProperty !== null
&& ceramicMold !== null
&& material !== GTMaterials.WroughtIron
&& material.hasFlag(TFGMaterialFlags.CAN_BE_UNMOLDED))
{
const outputMaterial = (tfcProperty.getOutputMaterial() === null) ? material : tfcProperty.getOutputMaterial();
const id = `${materialName}_${tagPrefixName}_${isFireMold ? 'fire' : 'ceramic'}`;
event.recipes.tfc.casting(outputItem, ceramicMold, Fluid.of(outputMaterial.getFluid(), mbAmount), isFireMold ? 0.01 : 0.1)
.id(`tfg:casting/${id}`);
event.recipes.create.filling(Item.of(ceramicMold, getFillingNBT(outputMaterial, mbAmount)), [
Fluid.of(outputMaterial.getFluid(), mbAmount),
Item.of(ceramicMold).strongNBT()
]).id(`tfg:filling/${id}`);
}
// If there's a gregtech mold, add alloy smelter/fluid solidifier recipes.
if (gtMold !== null) {
const ingotAmount = mbAmount / 144;
event.recipes.gtceu.alloy_smelter(`tfg:cast_${materialName}_${tagPrefixName}`)
.itemInputs(ChemicalHelper.get(TagPrefix.ingot, material, ingotAmount))
.notConsumable(gtMold)
.itemOutputs(outputItem)
.duration(material.getMass() * 2 * ingotAmount)
.EUt(getFluidRecipeEUt(material))
.category(GTRecipeCategories.INGOT_MOLDING)
event.recipes.gtceu.fluid_solidifier(`tfg:solidify_${materialName}_${tagPrefixName}`)
.inputFluids(Fluid.of(material.getFluid(), mbAmount))
.notConsumable(gtMold)
.itemOutputs(outputItem)
.duration(material.getMass() * 2 * ingotAmount)
.EUt(getFluidRecipeEUt(material))
}
}
/**
* @param {Internal.RecipesEventJS} event
* @param {Internal.ItemStack} outputItem
* @param {Internal.ItemStack} inputItem1
* @param {Internal.ItemStack} inputItem2
* @param {com.gregtechceu.gtceu.api.data.chemical.material.Material_} material
* @param {number} tierThreshold
* Should be 4 for everything except double ingots, which should be 5
* @param {number} nonTfcTier
* What recipe tier should non-tfc materials use? 0 for ulv, 1 for lv, etc
*/
function addMaterialWelding(event, outputItem, inputItem1, inputItem2, material, tierThreshold, nonTfcTier) {
const tfcProperty = material.getProperty(TFGPropertyKey.TFC_PROPERTY);
const id = `${material.getName()}_${linuxUnfucker(outputItem)}`;
let compactingTier = nonTfcTier;
if (tfcProperty !== null) {
event.recipes.tfc.welding(outputItem, inputItem1, inputItem2, tfcProperty.getTier() - 1)
.id(`tfc:welding/${id}`);
compactingTier = tfcProperty.getTier() < tierThreshold ? 0 : 1;
}
event.recipes.greate.compacting(outputItem, [inputItem1, inputItem2, 'tfc:powder/flux'])
.heated()
.recipeTier(compactingTier)
.circuitNumber(0)
.id(`tfg:compacting/${id}`);
event.recipes.gtceu.forming_press(`tfg:${id}`)
.itemInputs(inputItem1, inputItem2, 'tfc:powder/flux')
.itemOutputs(outputItem)
.duration(material.getMass())
.EUt(GTValues.VA[compactingTier]);
}
/**
* @param {Internal.RecipesEventJS} event
*/
function registerTFGMaterialRecipes(event) {
const $GreateMaterials = Java.loadClass("electrolyte.greate.registry.GreateMaterials")
forEachMaterial(material => {
// greate moment
if (material === $GreateMaterials.AndesiteAlloy
|| material === $GreateMaterials.RefinedRadiance
|| material === $GreateMaterials.ShadowSteel
|| material === $GreateMaterials.ChromaticCompound
|| material === GTMaterials.DamascusSteel)
{ return; }
if (material.hasProperty(PropertyKey.DUST)) {
processDust(event, material)
processPowder(event, material)
}
const toolProperty = material.getProperty(PropertyKey.TOOL)
if (toolProperty !== null) {
modifyRecyclingAmounts(material)
let circuit = 1;
processGTToolHead(event, GTToolType.SWORD, "sword_head", TFGTagPrefix.toolHeadSword, 'tfg:sword_head_extruder_mold', 'tfc:ceramic/sword_blade_mold', circuit++, material)
processGTToolHead(event, GTToolType.PICKAXE, "pickaxe_head", TFGTagPrefix.toolHeadPickaxe, 'tfg:pickaxe_head_extruder_mold', 'tfc:ceramic/pickaxe_head_mold', circuit++, material)
processGTToolHead(event, GTToolType.AXE, "axe_head", TFGTagPrefix.toolHeadAxe, 'tfg:axe_head_extruder_mold', 'tfc:ceramic/axe_head_mold', circuit++, material)
processGTToolHead(event, GTToolType.SHOVEL, "shovel_head", TFGTagPrefix.toolHeadShovel, 'tfg:shovel_head_extruder_mold', 'tfc:ceramic/shovel_head_mold', circuit++, material)
processGTToolHead(event, GTToolType.HOE, "hoe_head", TFGTagPrefix.toolHeadHoe, 'tfg:hoe_head_extruder_mold', 'tfc:ceramic/hoe_head_mold', circuit++, material)
processGTToolHead(event, GTToolType.KNIFE, "knife_head", TFGTagPrefix.toolHeadKnife, 'tfg:knife_head_extruder_mold', 'tfc:ceramic/knife_blade_mold', circuit++, material)
processGTToolHead(event, GTToolType.FILE, "file_head", TFGTagPrefix.toolHeadFile, 'tfg:file_head_extruder_mold', null, circuit++, material)
processGTToolHead(event, GTToolType.SAW, "saw_head", TFGTagPrefix.toolHeadSaw, 'tfg:saw_head_extruder_mold', 'tfc:ceramic/saw_blade_mold', circuit++, material)
processGTToolHead(event, GTToolType.SPADE, "spade_head", TFGTagPrefix.toolHeadSpade, 'tfg:spade_head_extruder_mold', null, circuit++, material)
processGTToolHead(event, GTToolType.MINING_HAMMER, "mining_hammer_head", TFGTagPrefix.toolHeadMiningHammer, 'tfg:mining_hammer_head_extruder_mold', null, circuit++, material)
processGTToolHead(event, GTToolType.SCYTHE, "scythe_head", TFGTagPrefix.toolHeadScythe, 'tfg:scythe_head_extruder_mold', 'tfc:ceramic/scythe_blade_mold', circuit++, material)
processGTToolHead(event, GTToolType.HARD_HAMMER, "hammer_head", TFGTagPrefix.toolHeadHammer, 'tfg:hammer_head_extruder_mold', 'tfc:ceramic/hammer_head_mold', circuit++, material)
processGTToolHead(event, GTToolType.BUTCHERY_KNIFE, "butchery_knife_head", TFGTagPrefix.toolHeadButcheryKnife, 'tfg:butchery_knife_head_extruder_mold', null, circuit++, material)
processGTToolHead(event, GTToolType.SCREWDRIVER, "screwdriver_tip", TagPrefix.toolHeadScrewdriver, 'tfg:screwdriver_tip_extruder_mold', null, circuit++, material)
processGTToolHead(event, GTToolType.WRENCH, "wrench_tip", TagPrefix.toolHeadWrench, 'tfg:wrench_tip_extruder_mold', null, circuit++, material)
processGTToolHead(event, GTToolType.WIRE_CUTTER, "wire_cutter_head", TagPrefix.toolHeadWireCutter, 'tfg:wire_cutter_head_extruder_mold', null, circuit++, material)
processToolMortar(event, GTToolType.MORTAR, material)
processToolHead(event, TFGTagPrefix.toolHeadPropick, "propick_head", 'tfg:propick_head_extruder_mold', 'tfc:ceramic/propick_head_mold', circuit++, material)
processToolHead(event, TFGTagPrefix.toolHeadJavelin, "javelin_head", 'tfg:javelin_head_extruder_mold', 'tfc:ceramic/javelin_head_mold', circuit++, material)
processToolHead(event, TFGTagPrefix.toolHeadChisel, "chisel_head", 'tfg:chisel_head_extruder_mold', 'tfc:ceramic/chisel_head_mold', circuit++, material)
processToolHead(event, TFGTagPrefix.toolHeadMace, "mace_head", 'tfg:mace_head_extruder_mold', 'tfc:ceramic/mace_head_mold', circuit++, material)
processToolHead(event, TFGTagPrefix.toolHeadMattock, "mattock_head", 'tfg:mattock_head_extruder_mold', null, circuit++, material)
processToolHead(event, TFGTagPrefix.toolHeadHook, "fish_hook", 'tfg:fish_hook_extruder_mold', null, circuit++, material)
}
if (material.hasProperty(PropertyKey.INGOT)) {
processIngot(event, material)
processIngotDouble(event, material)
processPlate(event, material)
processPlateDouble(event, material)
processBlock(event, material)
processFoil(event, material)
processRod(event, material)
processBars(event, material)
processBolt(event, material)
processScrew(event, material)
processRing(event, material)
processSpring(event, material)
processNugget(event, material)
processSmallGear(event, material)
processLargeGear(event, material)
processBuzzsawBlade(event, material)
processPlatedBlock(event, material)
}
if (material.hasProperty(PropertyKey.GEM)) {
processGems(event, material)
processPlate(event, material)
processBlock(event, material)
processRod(event, material)
processBolt(event, material)
processScrew(event, material)
processSmallGear(event, material)
processLargeGear(event, material)
processBuzzsawBlade(event, material)
}
if (material.hasProperty(TFGPropertyKey.TFC_PROPERTY)) {
processAnvil(event, material)
processLamp(event, material)
processTrapdoor(event, material)
processChain(event, material)
processBell(event, material)
}
if (material.hasFlag(TFGMaterialFlags.HAS_TFC_ARMOR)) {
processTFCArmor(event, material)
}
if (material.hasFlag(TFGMaterialFlags.HAS_TFC_TOOL) || material.hasFlag(TFGMaterialFlags.HAS_GT_TOOL)) {
processTFCTool(event, material)
}
const oreProperty = material.getProperty(PropertyKey.ORE);
if (oreProperty !== null) {
processSmallOre(event, material)
processPoorRawOre(event, material)
processNormalRawOre(event, material)
processRichRawOre(event, material)
processCrushedOre(event, material)
processPurifiedOre(event, material)
processRefinedOre(event, material)
processImpureDust(event, material)
processPureDust(event, material)
// Indicators
event.replaceInput({ id: `gtceu:shaped/${material.getName()}_surface_indicator` }, 'minecraft:gravel', '#tfc:rock/gravel')
}
})
}