From b5a1ed0ec98a62dbf6da464186e0f36ea2316f9a Mon Sep 17 00:00:00 2001 From: SpeeeDCraft <52341158+SpeeeDCraft@users.noreply.github.com> Date: Thu, 23 Nov 2023 06:54:52 +0700 Subject: [PATCH] Finnaly fix #65 --- kubejs/server_scripts/tfc/utility.js | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/kubejs/server_scripts/tfc/utility.js b/kubejs/server_scripts/tfc/utility.js index cfc2dc27e..c61fb4426 100644 --- a/kubejs/server_scripts/tfc/utility.js +++ b/kubejs/server_scripts/tfc/utility.js @@ -50,12 +50,26 @@ const addEmptyJson = (event, path) => { */ 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 + let json + + if (forging_temperature == null || welding_temperature == null) + { + json = { + ingredient: input, + heat_capacity: heat_capacity + } } + else + { + 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) }