Ого, оно работает 2

This commit is contained in:
SpeeeDCraft 2023-11-15 21:58:21 +07:00
parent 0b518eeffd
commit 4e26fa09bc
120 changed files with 201 additions and 1812 deletions

View file

@ -2,6 +2,7 @@
/**
* Здесь регистрируются файлы датапаков (json).
* Срабатывает до инициализации рецептов.
*/
ServerEvents.highPriorityData(event => {
registerTFCData(event)
@ -24,6 +25,7 @@ ServerEvents.tags('item', event => {
/**
* Здесь регистрируются рецепты (те же датапаки, но это событие немного специфичней).
* Срабатывает после инициализации датапаков.
*/
ServerEvents.recipes(event => {
registerSBRecipes(event)

View file

@ -244,79 +244,79 @@ const ItemHeats = {
input: (name) => { return { item: `tfc:metal/horse_armor/${name}` } },
output: (name) => { return { item: `tfc:metal/horse_armor/${name}` } } },
"sword_blade": { heat_capacity: 5.714, metal_amount: 288,
"sword_blade": { heat_capacity: 5.714, metal_amount: 288, hasMold: true,
input: (name) => { return { tag: `forge:sword_heads/${name}` } },
output: (name) => { return { item: `gtceu:${name}_sword_head` } } },
"sword": { heat_capacity: 5.714, metal_amount: 288, hasDur: true,
input: (name) => { return { item: `gtceu:${name}_sword` } },
output: (name) => { return { item: `gtceu:${name}_sword` } } },
"pickaxe_head": { heat_capacity: 2.857, metal_amount: 144,
"pickaxe_head": { heat_capacity: 2.857, metal_amount: 144, hasMold: true,
input: (name) => { return { tag: `forge:pickaxe_heads/${name}` } },
output: (name) => { return { tag: `forge:pickaxe_heads/${name}` } } },
output: (name) => { return { item: `gtceu:${name}_pickaxe_head` } } },
"pickaxe": { heat_capacity: 2.857, metal_amount: 144, hasDur: true,
input: (name) => { return { item: `gtceu:${name}_pickaxe` } },
output: (name) => { return { item: `gtceu:${name}_pickaxe` } } },
"axe_head": { heat_capacity: 2.857, metal_amount: 144,
"axe_head": { heat_capacity: 2.857, metal_amount: 144, hasMold: true,
input: (name) => { return { tag: `forge:axe_heads/${name}` } },
output: (name) => { return { item: `gtceu:${name}_axe_head` } } },
"axe": { heat_capacity: 2.857, metal_amount: 144, hasDur: true,
input: (name) => { return { item: `gtceu:${name}_axe` } },
output: (name) => { return { item: `gtceu:${name}_axe` } } },
"shovel_head": { heat_capacity: 2.857, metal_amount: 144,
"shovel_head": { heat_capacity: 2.857, metal_amount: 144, hasMold: true,
input: (name) => { return { tag: `forge:shovel_heads/${name}` } },
output: (name) => { return { item: `gtceu:${name}_shovel_head` } } },
"shovel": { heat_capacity: 2.857, metal_amount: 144, hasDur: true,
input: (name) => { return { item: `gtceu:${name}_shovel` } },
output: (name) => { return { item: `gtceu:${name}_shovel` } } },
"hammer_head": { heat_capacity: 2.857, metal_amount: 144,
"hammer_head": { heat_capacity: 2.857, metal_amount: 144, hasMold: true,
input: (name) => { return { tag: `forge:hammer_heads/${name}` } },
output: (name) => { return { item: `gtceu:${name}_hammer_head` } } },
"hammer": { heat_capacity: 2.857, metal_amount: 144, hasDur: true,
input: (name) => { return { item: `gtceu:${name}_hammer` } },
output: (name) => { return { item: `gtceu:${name}_hammer` } } },
"hoe_head": { heat_capacity: 2.857, metal_amount: 144,
"hoe_head": { heat_capacity: 2.857, metal_amount: 144, hasMold: true,
input: (name) => { return { tag: `forge:hoe_heads/${name}` } },
output: (name) => { return { item: `gtceu:${name}_hoe_head` } } },
"hoe": { heat_capacity: 2.857, metal_amount: 144, hasDur: true,
input: (name) => { return { item: `gtceu:${name}_hoe` } },
output: (name) => { return { item: `gtceu:${name}_hoe` } } },
"knife_blade": { heat_capacity: 2.857, metal_amount: 144,
"knife_blade": { heat_capacity: 2.857, metal_amount: 144, hasMold: true,
input: (name) => { return { tag: `forge:knife_heads/${name}` } },
output: (name) => { return { item: `gtceu:${name}_knife_head` } } },
"knife": { heat_capacity: 2.857, metal_amount: 144, hasDur: true,
input: (name) => { return { item: `gtceu:${name}_knife` } },
output: (name) => { return { item: `gtceu:${name}_knife` } } },
"saw_blade": { heat_capacity: 2.857, metal_amount: 144,
"saw_blade": { heat_capacity: 2.857, metal_amount: 144, hasMold: true,
input: (name) => { return { tag: `forge:saw_heads/${name}` } },
output: (name) => { return { item: `gtceu:${name}_saw_head` } } },
"saw": { heat_capacity: 2.857, metal_amount: 144, hasDur: true,
input: (name) => { return { item: `gtceu:${name}_saw` } },
output: (name) => { return { item: `gtceu:${name}_saw` } } },
"scythe_blade": { heat_capacity: 2.857, metal_amount: 144,
"scythe_blade": { heat_capacity: 2.857, metal_amount: 144, hasMold: true,
input: (name) => { return { tag: `forge:scythe_heads/${name}` } },
output: (name) => { return { item: `gtceu:${name}_scythe_head` } } },
"scythe": { heat_capacity: 2.857, metal_amount: 144, hasDur: true,
input: (name) => { return { item: `gtceu:${name}_scythe` } },
output: (name) => { return { item: `gtceu:${name}_scythe` } } },
"chisel_head": { heat_capacity: 2.857, metal_amount: 144,
"chisel_head": { heat_capacity: 2.857, metal_amount: 144, hasMold: true,
input: (name) => { return { item: `tfc:metal/chisel_head/${name}` } },
output: (name) => { return { item: `tfc:metal/chisel_head/${name}` } }, },
"chisel": { heat_capacity: 2.857, metal_amount: 144, hasDur: true,
input: (name) => { return { item: `tfc:metal/chisel/${name}` } },
output: (name) => { return { item: `tfc:metal/chisel/${name}` } } },
"javelin_head": { heat_capacity: 2.857, metal_amount: 144,
"javelin_head": { heat_capacity: 2.857, metal_amount: 144, hasMold: true,
input: (name) => { return { item: `tfc:metal/javelin_head/${name}` } },
output: (name) => { return { item: `tfc:metal/javelin_head/${name}` } } },
"javelin": { heat_capacity: 2.857, metal_amount: 144, hasDur: true,
input: (name) => { return { item: `tfc:metal/javelin/${name}` } },
output: (name) => { return { item: `tfc:metal/javelin/${name}` } } },
"propick_head": { heat_capacity: 2.857, metal_amount: 144,
"propick_head": { heat_capacity: 2.857, metal_amount: 144, hasMold: true,
input: (name) => { return { item: `tfc:metal/propick_head/${name}` } },
output: (name) => { return { item: `tfc:metal/propick_head/${name}` } } },
"propick": { heat_capacity: 2.857, metal_amount: 144, hasDur: true,
input: (name) => { return { item: `tfc:metal/propick/${name}` } },
output: (name) => { return { item: `tfc:metal/propick/${name}` } } },
"mace_head": { heat_capacity: 5.714, metal_amount: 288,
"mace_head": { heat_capacity: 5.714, metal_amount: 288, hasMold: true,
input: (name) => { return { item: `tfc:metal/mace_head/${name}` } },
output: (name) => { return { item: `tfc:metal/mace_head/${name}` } } },
"mace": { heat_capacity: 5.714, metal_amount: 288, hasDur: true,
@ -338,9 +338,9 @@ const ItemHeats = {
input: (name) => { return { item: `tfc:metal/shield/${name}` } },
output: (name) => { return { item: `tfc:metal/shield/${name}` } } },
"ingot": { heat_capacity: 2.857, metal_amount: 144,
"ingot": { heat_capacity: 2.857, metal_amount: 144, hasMold: true,
input: (name) => { return { tag: `forge:ingots/${name}` } },
output: (name) => { return { item: Item.getId(ChemicalHelper.get(TagPrefix.ingot, GTMaterials.get(name), 1)) } } },
output: (name) => { return { item: Item.getId(AlmostUnified.getPreferredItemForTag(`forge:ingots/${name}`)) + "" } } },
"double_ingot": { heat_capacity: 5.714, metal_amount: 288,
input: (name) => { return { item: `tfc:metal/double_ingot/${name}` } },
output: (name) => { return { item: `tfc:metal/double_ingot/${name}` } } },
@ -365,10 +365,10 @@ const Metals = {
"tin": { forging_temp: 138, welding_temp: 184, melt_temp: 230, fluidName: "gtceu:tin", props: [].concat(ingotGen, doubleIngotGen, nuggetGen, dustGen, oreGen, partGen) },
"zinc": { forging_temp: 252, welding_temp: 336, melt_temp: 420, fluidName: "gtceu:zinc", props: [].concat(ingotGen, doubleIngotGen, nuggetGen, dustGen, partGen) },
"sterling_silver": { forging_temp: 570, welding_temp: 760, melt_temp: 950, fluidName: "gtceu:sterling_silver", props: [].concat(ingotGen, doubleIngotGen, nuggetGen, dustGen, partGen) },
"copper": { forging_temp: 648, welding_temp: 864, melt_temp: 1080, fluidName: "gtceu:copper", props: [].concat(ingotGen, doubleIngotGen, nuggetGen, dustGen, oreGen, partGen, armorGen, gtToolGen, tfcToolGen, utilityGen) },
"bismuth_bronze": { forging_temp: 591, welding_temp: 788, melt_temp: 985, fluidName: "gtceu:bismuth_bronze", props: [].concat(ingotGen, doubleIngotGen, nuggetGen, dustGen, partGen, armorGen, gtToolGen, tfcToolGen, utilityGen) },
"bronze": { forging_temp: 570, welding_temp: 760, melt_temp: 950, fluidName: "gtceu:bronze", props: [].concat(ingotGen, doubleIngotGen, nuggetGen, dustGen, partGen, armorGen, gtToolGen, tfcToolGen, utilityGen) },
"black_bronze": { forging_temp: 642, welding_temp: 856, melt_temp: 1070, fluidName: "gtceu:black_bronze", props: [].concat(ingotGen, doubleIngotGen, nuggetGen, dustGen, partGen, armorGen, gtToolGen, tfcToolGen, utilityGen) },
"copper": { forging_temp: 648, welding_temp: 864, melt_temp: 1080, fluidName: "gtceu:copper", canBeUnmolded: true, props: [].concat(ingotGen, doubleIngotGen, nuggetGen, dustGen, oreGen, partGen, armorGen, gtToolGen, tfcToolGen, utilityGen) },
"bismuth_bronze": { forging_temp: 591, welding_temp: 788, melt_temp: 985, fluidName: "gtceu:bismuth_bronze", canBeUnmolded: true, props: [].concat(ingotGen, doubleIngotGen, nuggetGen, dustGen, partGen, armorGen, gtToolGen, tfcToolGen, utilityGen) },
"bronze": { forging_temp: 570, welding_temp: 760, melt_temp: 950, fluidName: "gtceu:bronze", canBeUnmolded: true, props: [].concat(ingotGen, doubleIngotGen, nuggetGen, dustGen, partGen, armorGen, gtToolGen, tfcToolGen, utilityGen) },
"black_bronze": { forging_temp: 642, welding_temp: 856, melt_temp: 1070, fluidName: "gtceu:black_bronze", canBeUnmolded: true, props: [].concat(ingotGen, doubleIngotGen, nuggetGen, dustGen, partGen, armorGen, gtToolGen, tfcToolGen, utilityGen) },
"wrought_iron": { forging_temp: 921, welding_temp: 1228, melt_temp: 1535, fluidName: "gtceu:wrought_iron", props: [].concat(ingotGen, doubleIngotGen, nuggetGen, dustGen, partGen, armorGen, gtToolGen, tfcToolGen, utilityGen) },
"iron": { forging_temp: 921, welding_temp: 1228, melt_temp: 1535, fluidName: "gtceu:iron", props: [].concat(ingotGen, dustGen, oreGen, gtToolGen, partGen) },
"cast_iron": { forging_temp: 921, welding_temp: 1228, melt_temp: 1535, fluidName: "gtceu:iron", props: doubleIngotGen },

View file

@ -1,27 +1,10 @@
// priority: 0
const registerTFCData = (event) => {
registerTFCItemHeats(event)
registerTFCHeatingRecipes(event)
registerTFCCastingRecipes(event)
addBloomeryRecipe(event,
'tfc:recipes/bloomery/raw_iron_bloom',
{ item: "tfc:raw_iron_bloom" },
{ ingredient: "gtceu:iron", amount: 144 },
{ item: "minecraft:charcoal" },
15000
)
addTFCBlastFurnaceRecipe(event,
'tfc:recipes/blast_furnace/pig_iron',
{ ingredient: "gtceu:iron", amount: 1 },
{ fluid: "tfc:metal/pig_iron", amount: 1 },
{ tag: "tfc:flux" }
)
registerAutoTFCItemHeats(event)
}
const registerTFCItemHeats = (event) => {
const registerAutoTFCItemHeats = (event) => {
for (const [tfcMetalName, metalSpecifications] of Object.entries(Metals)) {
metalSpecifications.props.forEach(propertyName => {
let itemType = ItemHeats[propertyName]
@ -38,60 +21,4 @@ const registerTFCItemHeats = (event) => {
)
})
}
}
const registerTFCHeatingRecipes = (event) => {
for (const [tfcMetalName, metalSpecifications] of Object.entries(Metals)) {
metalSpecifications.props.forEach(propertyName => {
let jsonRecipePath = `tfc:recipes/heating/tfg/${tfcMetalName}_${propertyName}`
let itemTypeSpecifications = ItemHeats[propertyName]
if (itemTypeSpecifications.heat_capacity != null) {
let ingredientInput = itemTypeSpecifications.input(tfcMetalName)
let json
if (typeof(itemTypeSpecifications.metal_amount) == "object")
{
if (itemTypeSpecifications.metal_amount[tfcMetalName] != undefined)
{
addHeatingItemToFluidRecipe(
event,
jsonRecipePath,
ingredientInput,
{ fluid: metalSpecifications.fluidName, amount: itemTypeSpecifications.metal_amount[tfcMetalName] },
metalSpecifications.melt_temp,
(itemTypeSpecifications.hasDur != undefined) ? itemTypeSpecifications.hasDur : false
)
}
else
{
addHeatingItemToFluidRecipe(
event,
jsonRecipePath,
ingredientInput,
{ fluid: metalSpecifications.fluidName, amount: itemTypeSpecifications.metal_amount["default"] },
metalSpecifications.melt_temp,
(itemTypeSpecifications.hasDur != undefined) ? itemTypeSpecifications.hasDur : false
)
}
}
else {
addHeatingItemToFluidRecipe(
event,
jsonRecipePath,
ingredientInput,
{ fluid: metalSpecifications.fluidName, amount: itemTypeSpecifications.metal_amount },
metalSpecifications.melt_temp,
(itemTypeSpecifications.hasDur != undefined) ? itemTypeSpecifications.hasDur : false
)
}
}
})
}
}
const registerTFCCastingRecipes = (event) => {
}
}

View file

@ -3,10 +3,13 @@
const registerTFCRecipes = (event) => {
// event.remove({ id: /tfc:anvil.*/ })
// event.remove({ id: /tfc:welding.*/ })
// event.remove({ id: /tfc:casting.*/ })
event.remove({ id: /tfc:casting\/.*/ })
event.remove({ id: /tfc:heating\/metal.*/ })
event.remove({ id: /tfc:heating\/ore.*/ })
registerAutoTFCHeatingRecipes(event)
registerAutoTFCCastingRecipes(event)
event.remove({ id: 'tfc:crafting/vanilla/lapis_block' })
event.remove({ id: 'tfc:quern/amethyst' })
@ -342,4 +345,97 @@ const registerTFCRecipes = (event) => {
{ tag: "forge:rich_raw_materials/borax" },
{ item: "tfc:powder/flux", count: 6 }
)
}
const registerAutoTFCHeatingRecipes = (event) => {
for (const [tfcMetalName, metalSpecifications] of Object.entries(Metals)) {
metalSpecifications.props.forEach(propertyName => {
let jsonRecipePath = `tfc:recipes/heating/tfg/${tfcMetalName}_${propertyName}`
let itemTypeSpecifications = ItemHeats[propertyName]
if (itemTypeSpecifications.heat_capacity != null) {
let ingredientInput = itemTypeSpecifications.input(tfcMetalName)
let json
if (typeof(itemTypeSpecifications.metal_amount) == "object")
{
if (itemTypeSpecifications.metal_amount[tfcMetalName] != undefined)
{
addHeatingItemToFluidRecipe(
event,
jsonRecipePath,
ingredientInput,
{ fluid: metalSpecifications.fluidName, amount: itemTypeSpecifications.metal_amount[tfcMetalName] },
metalSpecifications.melt_temp,
(itemTypeSpecifications.hasDur != undefined) ? itemTypeSpecifications.hasDur : false
)
}
else
{
addHeatingItemToFluidRecipe(
event,
jsonRecipePath,
ingredientInput,
{ fluid: metalSpecifications.fluidName, amount: itemTypeSpecifications.metal_amount["default"] },
metalSpecifications.melt_temp,
(itemTypeSpecifications.hasDur != undefined) ? itemTypeSpecifications.hasDur : false
)
}
}
else {
addHeatingItemToFluidRecipe(
event,
jsonRecipePath,
ingredientInput,
{ fluid: metalSpecifications.fluidName, amount: itemTypeSpecifications.metal_amount },
metalSpecifications.melt_temp,
(itemTypeSpecifications.hasDur != undefined) ? itemTypeSpecifications.hasDur : false
)
}
}
})
}
}
const registerAutoTFCCastingRecipes = (event) => {
for (const [tfcMetalName, metalSpecifications] of Object.entries(Metals)) {
metalSpecifications.props.forEach(propertyName => {
let property = ItemHeats[propertyName]
if (property.hasMold != undefined)
{
let recipeId = `tfc:recipes/casting_tfg/${propertyName}_${tfcMetalName}`
if (metalSpecifications.canBeUnmolded != undefined || propertyName == "ingot")
{
addCastingRecipe(event,
recipeId,
{ item: `tfc:ceramic/${propertyName}_mold` },
{ ingredient: metalSpecifications.fluidName, amount: property.metal_amount},
property.output(tfcMetalName),
(propertyName.includes("blade") || propertyName.includes("head") ? 1 : 0.01)
)
if (propertyName == "ingot") {
let recipeId2 = `tfc:recipes/casting_tfg/fire_${propertyName}_${tfcMetalName}`
console.log(shit)
addCastingRecipe(event,
recipeId2,
{ item: `tfc:ceramic/fire_${propertyName}_mold` },
{ ingredient: metalSpecifications.fluidName, amount: property.metal_amount},
property.output(tfcMetalName),
0.01
)
}
}
}
})
}
}

View file

@ -61,43 +61,43 @@ const addItemHeat = (event, customPath, input, heat_capacity, forging_temperatur
}
/**
* Создает json рецепта нагрева, предмет -> жидкость, в основном используется для металлов.
* @param { ServerEvents.highPriorityData } event Событие в котором вызывается.
* Создает рецепта нагрева, предмет -> жидкость, в основном используется для металлов.
* @param { ServerEvents.recipes } event Событие в котором вызывается.
* @param { String } recipeId Название рецепта.
* @param { Object } input Объект входа, может принимать объект с тэгом или предметом.
* @param { Object } result_fluid Результирующая жидкость после расплава предмета.
* @param { Number } temperature Температура при которой произойдет рецепт.
*/
const addHeatingItemToFluidRecipe = (event, recipeId, input, result_fluid, temperature, useDurab) => {
event.addJson(recipeId, {
event.custom({
type: "tfc:heating",
ingredient: input,
result_fluid: result_fluid,
temperature: temperature,
use_durability: useDurab
})
}).id(recipeId)
}
/**
* Создает json рецепт нагрева, предмет -> предмет, в основном используется для обычных предметов.
* @param { ServerEvents.highPriorityData } event Событие в котором вызывается.
* Создает рецепт нагрева, предмет -> предмет, в основном используется для обычных предметов.
* @param { ServerEvents.recipes } event Событие в котором вызывается.
* @param { String } recipeId Название рецепта.
* @param { Object } input Объект входа, может принимать объект с тэгом или предметом.
* @param { Object } result_fluid Результирующий предмет после достижения требуемой температуры.
* @param { Number } temperature Температура при которой произойдет рецепт.
*/
const addHeatingItemToItemRecipe = (event, recipeId, input, result_item, temperature) => {
event.addJson(recipeId, {
event.custom({
type: "tfc:heating",
ingredient: input,
result_item: result_item,
temperature: temperature
})
}).id(recipeId)
}
/**
* Создает json рецепт для доменной печки лоу тира.
* @param { ServerEvents.highPriorityData } event Событие в котором вызывается.
* Создает рецепт для доменной печки лоу тира.
* @param { ServerEvents.recipes } event Событие в котором вызывается.
* @param { String } recipeId Название рецепта.
* @param { Object } result Объект выхода, может принимать объект с тэгом или предметом.
* @param { Object } fluid Объект жидкости, может принимать объект с жидкостью и ее кол-вом.
@ -105,30 +105,49 @@ const addHeatingItemToItemRecipe = (event, recipeId, input, result_item, tempera
* @param { number } duration Длительность рецепта.
*/
const addBloomeryRecipe = (event, recipeId, result, fluid, catalyst, duration) => {
event.addJson(recipeId, {
event.custom({
type: "tfc:bloomery",
result: result,
fluid: fluid,
catalyst: catalyst,
duration: duration
})
}).id(recipeId)
}
/**
* Создает json рецепт для доменной печки нормал тира.
* @param { ServerEvents.highPriorityData } event Событие в котором вызывается.
* Создает рецепт для доменной печки нормал тира.
* @param { ServerEvents.recipes } event Событие в котором вызывается.
* @param { String } recipeId Название рецепта.
* @param { Object } fluid Объект жидкости, может принимать объект с жидкостью и ее кол-вом.
* @param { Object } result Объект выхода, может принимать объект с тэгом или предметом.
* @param { Object } catalyst Объект катализатора, может принимать объект с тэгом или предметом.
*/
const addTFCBlastFurnaceRecipe = (event, recipeId, fluid, result, catalyst) => {
event.addJson(recipeId, {
event.custom({
type: "tfc:blast_furnace",
fluid: fluid,
result: result,
catalyst: catalyst
})
}).id(recipeId)
}
/**
*
* @param { ServerEvents.recipes } event
* @param {*} recipeId
* @param {*} inputMold
* @param {*} fluidInMold
* @param {*} result
* @param {*} break_chance
*/
const addCastingRecipe = (event, recipeId, inputMold, fluidInMold, resultOutput, break_chance) => {
event.custom({
type: "tfc:casting",
mold: inputMold,
fluid: fluidInMold,
result: resultOutput,
break_chance: break_chance
}).id(recipeId)
}
/*