diff --git a/CHANGELOG.md b/CHANGELOG.md index aa39df6e0..8b653c7c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased ### Changes +- High Tier saws can Silk Harvest Ice (#3019) @Nebby1999 ### Bug fixes ### Translation updates diff --git a/kubejs/client_scripts/tooltips.js b/kubejs/client_scripts/tooltips.js index d4e336e7a..e3870c9b1 100644 --- a/kubejs/client_scripts/tooltips.js +++ b/kubejs/client_scripts/tooltips.js @@ -521,4 +521,16 @@ const registerTooltips = (event) => { event.addAdvanced(['gtceu:ice_bucket'], (item, advanced, text) => { text.add(1, Text.translate('tfg.tooltip.cooling_foods')); }) + + // Saw can silk harvest ice + //This kinda sucks, but it works. We're basically getting the default "silk_ice" harvesting tooltip, getting the index, then removing it. + //Then, we insert on that index our custom tooltip that tells the player it harvests ALL ice blocks + event.addAdvanced(['#tfg:silk_harvest_ice'], (item, advanced, text) => { + const sculptorKey = "item.gtceu.tool.behavior.silk_ice"; + let keyToRemove = text.find(tip => tip.toString().indexOf(sculptorKey) != -1); + let indexOf = text.findIndex(tip => tip.toString().indexOf(sculptorKey) != -1); + + text.remove(keyToRemove); + text.add(indexOf, Text.translate("tfg.tooltip.tool_behaviour.silk_ice")); + }) } diff --git a/kubejs/server_scripts/gregtech/tags.js b/kubejs/server_scripts/gregtech/tags.js index 91ea36295..d2ae45694 100644 --- a/kubejs/server_scripts/gregtech/tags.js +++ b/kubejs/server_scripts/gregtech/tags.js @@ -37,6 +37,18 @@ function registerGTCEUItemTags(event) { event.add("tfc:saws", "#forge:tools/buzzsaws"); event.add("tfc:saws", "#forge:tools/chainsaws"); + const saws = event.get('forge:tools/saws').getObjectIds().concat(event.get('forge:tools/chainsaws').getObjectIds()); + saws.forEach(sawId => + { + const id = sawId.getNamespace() + ":" + sawId.getPath(); + if(global.ICE_SAW_BLACKLIST.includes(id) || Item.of(sawId).hasTag('forge:tools/buzzsaws')) + { + return; + } + + event.add("tfg:silk_harvest_ice", id); + }); + global.GTCEU_CASTING_MOLDS.concat(global.TFG_CASTING_MOLDS).forEach((mold) => { event.add("gtceu:casting_molds", mold); }); diff --git a/kubejs/server_scripts/tfc/loot.js b/kubejs/server_scripts/tfc/loot.js index 5a895445f..50f86efc8 100644 --- a/kubejs/server_scripts/tfc/loot.js +++ b/kubejs/server_scripts/tfc/loot.js @@ -1,6 +1,9 @@ // priority: 0 "use strict"; - +/** + * + * @param {Internal.LootModificationEventJS} event + */ function registerTFCLoots(event) { // Hostile animals @@ -352,8 +355,15 @@ function registerTFCLoots(event) { event.addBlockLootModifier('minecraft:ice') .removeLoot(ItemFilter.ALWAYS_TRUE) + + event.addBlockLootModifier('minecraft:ice') + .not(n => n.matchMainHand("#tfg:silk_harvest_ice")) .addLoot('firmalife:ice_shavings') + event.addBlockLootModifier('minecraft:ice') + .matchMainHand("#tfg:silk_harvest_ice") + .addLoot('minecraft:ice'); + event.addBlockLootModifier('minecraft:packed_ice') .not(n => n.matchMainHand("#forge:tools/saws")) .addWeightedLoot([4, 6], ['firmalife:ice_shavings']) diff --git a/kubejs/startup_scripts/tfg/constants.js b/kubejs/startup_scripts/tfg/constants.js index f838803e0..84d16156d 100644 --- a/kubejs/startup_scripts/tfg/constants.js +++ b/kubejs/startup_scripts/tfg/constants.js @@ -251,4 +251,20 @@ global.FISH_INDEX = [ { id: 'tfc:tropical_fish', item: 'tfc:food/tropical_fish', parent: 'tfc:bucket/tropical_fish', dimension: null }, { id: 'tfc:pufferfish', item: 'minecraft:pufferfish', parent: 'tfc:bucket/pufferfish', dimension: null }, { id: 'wan_ancient_beasts:toxlacanth', item: 'wan_ancient_beasts:toxlacanth', parent: 'wan_ancient_beasts:toxlacanth_bucket', dimension: 'ad_astra:mars' } -]; \ No newline at end of file +]; + +/** + * @type {string[]} - Saws unable to silk harvest ice + */ +global.ICE_SAW_BLACKLIST = [ + "gtceu:damascus_steel_saw", + "gtceu:steel_saw", + "gtceu:bronze_saw", + "gtceu:bismuth_bronze_saw", + "gtceu:copper_saw", + "gtceu:cobalt_brass_saw", + "gtceu:black_steel_saw", + "gtceu:black_bronze_saw", + "gtceu:wrought_iron_saw", + "gtceu:invar_saw" +] \ No newline at end of file