Навожу красивости
This commit is contained in:
parent
e37426eb4c
commit
08a0cf6aa8
5 changed files with 166 additions and 56 deletions
|
|
@ -35,11 +35,11 @@ const registerCreateRecipes = (event) => {
|
|||
});
|
||||
|
||||
// galvanized_iron
|
||||
customWelding(event, ["forge:ingots/iron", "forge:plates/zinc"], "kubejs:galvanized_iron", 3);
|
||||
customWelding(event, ["forge:ingots/wrought_iron", "forge:plates/zinc"], "kubejs:galvanized_iron", 3);
|
||||
customHeating(event, "forge:ingots/galvanized_iron", ["tfc:metal/wrought_iron", 144], 1400);
|
||||
//customWelding(event, ["forge:ingots/iron", "forge:plates/zinc"], "kubejs:galvanized_iron", 3);
|
||||
//customWelding(event, ["forge:ingots/wrought_iron", "forge:plates/zinc"], "kubejs:galvanized_iron", 3);
|
||||
//customHeating(event, "forge:ingots/galvanized_iron", ["tfc:metal/wrought_iron", 144], 1400);
|
||||
//customHeatLevel(event,"forge:ingots/galvanized_iron", 5.714, 921, 1228);
|
||||
|
||||
//shaft craft
|
||||
customAnvil(event, "forge:ingots/galvanized_iron", ["create:shaft", 4], 3, ["hit_last", "hit_second_last", "hit_third_last"]);
|
||||
//customAnvil(event, "forge:ingots/galvanized_iron", ["create:shaft", 4], 3, ["hit_last", "hit_second_last", "hit_third_last"]);
|
||||
}
|
||||
|
|
@ -1,18 +1,30 @@
|
|||
// priority: 499
|
||||
|
||||
/**
|
||||
* Здесь регистрируются файлы датапаков (json).
|
||||
*/
|
||||
ServerEvents.highPriorityData(event => {
|
||||
registerTFCData(event)
|
||||
})
|
||||
|
||||
/**
|
||||
* Здесь регистрируются тэги для блоков.
|
||||
*/
|
||||
ServerEvents.tags('block', event => {
|
||||
|
||||
})
|
||||
|
||||
/**
|
||||
* Здесь регистрируются тэги для предметов.
|
||||
*/
|
||||
ServerEvents.tags('item', event => {
|
||||
registerCreateTags(event)
|
||||
registerTFCTags(event)
|
||||
})
|
||||
|
||||
/**
|
||||
* Здесь регистрируются рецепты (те же датапаки, но это событие немного специфичней).
|
||||
*/
|
||||
ServerEvents.recipes(event => {
|
||||
registerSBRecipes(event)
|
||||
registerCreateRecipes(event)
|
||||
|
|
@ -21,11 +33,53 @@ ServerEvents.recipes(event => {
|
|||
registerTFCRecipes(event)
|
||||
})
|
||||
|
||||
/**
|
||||
* Здесь регистрируется кастомный дроп.
|
||||
*/
|
||||
LootJS.modifiers((event) => {
|
||||
modifyLootGT(event)
|
||||
});
|
||||
|
||||
BlockEvents.rightClicked(event => {
|
||||
console.log(event.getBlock())
|
||||
console.log(event.getItem())
|
||||
/**
|
||||
* Смываем за разрабами GTCEu и исправляем их баги.
|
||||
* Баги:
|
||||
* 1. Не работает очистка дерева от коры.
|
||||
* 2. Не работает очистка меди от меда.
|
||||
* 3. Не работает очистка меди от ржавчины.
|
||||
*/
|
||||
ItemEvents.rightClicked(event => {
|
||||
const block = event.getTarget().block
|
||||
const item = event.getItem()
|
||||
|
||||
const blockId = block.getId()
|
||||
const axeItemTagName = "tfc:axes"
|
||||
|
||||
if (block == undefined) return;
|
||||
|
||||
if (item.hasTag(axeItemTagName))
|
||||
{
|
||||
// Wood, Log -> Bark
|
||||
if (blockId.includes("tfc:wood/log/"))
|
||||
{
|
||||
const woodName = block.getId().split('/')[2]
|
||||
|
||||
block.set("tfc:wood/stripped_log/" + woodName, block.getProperties())
|
||||
}
|
||||
else if (blockId.includes("tfc:wood/wood/"))
|
||||
{
|
||||
const woodName = blockId.split('/')[2]
|
||||
|
||||
block.set("tfc:wood/stripped_wood/" + woodName, block.getProperties())
|
||||
}
|
||||
// Wax Scrapping
|
||||
else if (false)
|
||||
{
|
||||
|
||||
}
|
||||
// Scrap Scrapping
|
||||
else if (false)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
@ -8,22 +8,17 @@ const registerTFCItemHeats = (event) => {
|
|||
for (const [tfcMetalName, metalSpecifications] of Object.entries(Metals)) {
|
||||
metalSpecifications.props.forEach(propertyName => {
|
||||
let itemType = ItemHeats[propertyName]
|
||||
let path = `tfc:tfc/item_heats/metal/${tfcMetalName}_${propertyName}`
|
||||
let pathToExistFile = `tfc:tfc/item_heats/metal/${tfcMetalName}_${propertyName}`
|
||||
|
||||
if (itemType.heat_capacity == null) {
|
||||
event.addJson(path, emptyJson)
|
||||
}
|
||||
else {
|
||||
let ingredient = itemType.input(tfcMetalName)
|
||||
|
||||
let json = {
|
||||
ingredient: ingredient,
|
||||
heat_capacity: itemType.heat_capacity,
|
||||
forging_temperature: metalSpecifications.forging_temp,
|
||||
welding_temperature: metalSpecifications.welding_temp
|
||||
}
|
||||
event.addJson(path, json)
|
||||
}
|
||||
if (itemType.heat_capacity == null) addEmptyJson(event, pathToExistFile)
|
||||
else addItemHeat(
|
||||
event,
|
||||
`metal/${tfcMetalName}_${propertyName}`,
|
||||
itemType.input(tfcMetalName),
|
||||
itemType.heat_capacity,
|
||||
metalSpecifications.forging_temp,
|
||||
metalSpecifications.welding_temp
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -410,6 +410,8 @@ const registerTFCHeatingRecipes = (event) => {
|
|||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
const registerTFCCastingRecipes = (event) => {
|
||||
|
|
|
|||
|
|
@ -1,41 +1,113 @@
|
|||
// priority: 0
|
||||
|
||||
/**
|
||||
* Нужен для того, чтобы удалять рецепты или блокировать json файлы,
|
||||
* которые нельзя удалить по id (допустим нагревательные спецификации предметов).
|
||||
* Рекомендуется не использовать.
|
||||
*/
|
||||
const emptyJson = {
|
||||
conditions: [
|
||||
{ type: "forge:false" }
|
||||
]
|
||||
}
|
||||
|
||||
const customWelding = (event, [input1, input2], result, tier) => {
|
||||
/**
|
||||
* Генерирует рандомную строку.
|
||||
* @param { Number } length Длина строки.
|
||||
* @returns Строка из рандомных символов.
|
||||
*/
|
||||
const makeId = (length) => {
|
||||
let result = '';
|
||||
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
const charactersLength = characters.length;
|
||||
let counter = 0;
|
||||
while (counter < length) {
|
||||
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
||||
counter += 1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Вставляет пустой json, по пути и блокирует что-либо по этому пути.
|
||||
* @param { ServerEvents.highPriorityData } event Событие в котором вызывается.
|
||||
* @param { String } path Путь по которому нужно вставить пустой json.
|
||||
*/
|
||||
const addEmptyJson = (event, path) => {
|
||||
event.addJson(path, emptyJson)
|
||||
}
|
||||
|
||||
/**
|
||||
* Метод создает нагревательную спецификации для предмета.
|
||||
* Используется только в событии генерации датапаков, не является рецептом.
|
||||
* @param { ServerEvents.highPriorityData } event Событие в котором вызывается.
|
||||
* @param { String } customPath Путь, начинается с [tfc:tfc/item_heats/], если указан customPath,
|
||||
* то добавляется после [tfc:tfc/item_heats/], если не указан, генерируется сам.
|
||||
* @param { Object } input Объект ингредиента, может включать предмет, или тэг.
|
||||
* @param { Number } heat_capacity Теплоемкость объекта.
|
||||
* @param { Number } forging_temperature Температура ковки.
|
||||
* @param { Number } welding_temperature Температура сварки.
|
||||
*/
|
||||
const addItemHeat = (event, customPath, input, heat_capacity, forging_temperature, welding_temperature) => {
|
||||
const defaultPath = `tfc:tfc/item_heats/`
|
||||
const json = {
|
||||
ingredient: input,
|
||||
heat_capacity: heat_capacity,
|
||||
forging_temperature: forging_temperature,
|
||||
welding_temperature: welding_temperature
|
||||
}
|
||||
|
||||
event.addJson((customPath == null) ? defaultPath + makeId(20) : defaultPath + customPath, json)
|
||||
}
|
||||
|
||||
/**
|
||||
* Создает рецепт нагрева, предмет -> жидкость, в основном используется для металлов.
|
||||
* @param { ServerEvents.recipes } event Событие в котором вызывается.
|
||||
* @param { String } id Название рецепта, если не указать сгенерируется автоматически, рекомендуется задать вручную.
|
||||
* @param { Object } input Объект входа, может принимать объект с тэгом или предметом.
|
||||
* @param { Object } result_fluid Результирующая жидкость после расплава предмета.
|
||||
* @param { Number } temperature Температура при которой произойдет рецепт.
|
||||
*/
|
||||
const addHeatingItemToFluidRecipe = (event, id, input, result_fluid, temperature) => {
|
||||
event.custom({
|
||||
type: "tfc:welding",
|
||||
first_input: {
|
||||
tag: input1
|
||||
},
|
||||
second_input: {
|
||||
tag: input2
|
||||
},
|
||||
result: {
|
||||
item: result
|
||||
},
|
||||
tier: tier,
|
||||
id: id,
|
||||
type: "tfc:heating",
|
||||
ingredient: input,
|
||||
result_fluid: result_fluid,
|
||||
temperature: temperature
|
||||
})
|
||||
}
|
||||
|
||||
const customHeating = (event, input1, [result, amount], temperature) => {
|
||||
/**
|
||||
* Создает рецепт нагрева, предмет -> предмет, в основном используется для обычных предметов.
|
||||
* @param { ServerEvents.recipes } event Событие в котором вызывается.
|
||||
* @param { String } id Название рецепта, если не указать сгенерируется автоматически, рекомендуется задать вручную.
|
||||
* @param { Object } input Объект входа, может принимать объект с тэгом или предметом.
|
||||
* @param { Object } result_fluid Результирующий предмет после достижения требуемой температуры.
|
||||
* @param { Number } temperature Температура при которой произойдет рецепт.
|
||||
*/
|
||||
const addHeatingItemToItemRecipe = (event, id, input, result_item, temperature) => {
|
||||
event.custom({
|
||||
id: id,
|
||||
type: "tfc:heating",
|
||||
ingredient: {
|
||||
tag: input1
|
||||
},
|
||||
result_fluid: {
|
||||
fluid: result,
|
||||
amount: amount
|
||||
},
|
||||
ingredient: input,
|
||||
result_item: result_item,
|
||||
temperature: temperature
|
||||
})
|
||||
}
|
||||
|
||||
/*
|
||||
const addWeldingRecipe = (event, id, input1, input2, output, tier) => {
|
||||
event.custom({
|
||||
id: id,
|
||||
type: "tfc:welding",
|
||||
first_input: input1,
|
||||
second_input: input2,
|
||||
result: output,
|
||||
tier: tier,
|
||||
})
|
||||
}
|
||||
|
||||
const customAnvil = (event, input1, [result, count], tier, [firstRule, secondRule, thirdRule]) => {
|
||||
event.custom({
|
||||
type: "tfc:anvil",
|
||||
|
|
@ -53,20 +125,7 @@ const customAnvil = (event, input1, [result, count], tier, [firstRule, secondRul
|
|||
thirdRule
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
// Кастомная температура плавления
|
||||
|
||||
const customHeatLevel = (event, input1, heat_capacity, forging_temperature, welding_temperature) => {
|
||||
event.custom({
|
||||
ingredient: {
|
||||
item: input1
|
||||
},
|
||||
heat_capacity: heat_capacity,
|
||||
forging_temperature: forging_temperature,
|
||||
welding_temperature: welding_temperature
|
||||
})
|
||||
}
|
||||
}*/
|
||||
|
||||
const addQuernRecipe = (event, input, output) => {
|
||||
event.custom({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue