diff --git a/kubejs/assets/tfg/lang/en_us.json b/kubejs/assets/tfg/lang/en_us.json index 1a713896b..8e8846be7 100644 --- a/kubejs/assets/tfg/lang/en_us.json +++ b/kubejs/assets/tfg/lang/en_us.json @@ -631,6 +631,8 @@ "block.tfg.titanium_concrete_bricks": "Titanium-Rebar Concrete Bricks", "block.tfg.titanium_concrete_bricks_small": "Small Titanium-Rebar Concrete Bricks", "block.tfg.titanium_concrete_bricks_square": "Square Titanium-Rebar Concrete Bricks", + "block.tfg.glacian_wool_frame": "Framed Glacian Wool", + "block.tfg.aes_insulation_frame": "Framed AES Insulation", "block.tfg.nuclear_turbine": "Nuclear Steam Turbine", "block.tfg.evaporation_tower": "Evaporation Tower", "block.tfg.growth_monitor": "Growth Monitor", diff --git a/kubejs/assets/tfg/models/block/aes_insulation_frame.json b/kubejs/assets/tfg/models/block/aes_insulation_frame.json new file mode 100644 index 000000000..9f6311f21 --- /dev/null +++ b/kubejs/assets/tfg/models/block/aes_insulation_frame.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "tfg:block/aes_insulation_frame" + } +} \ No newline at end of file diff --git a/kubejs/assets/tfg/models/block/glacian_wool_frame.json b/kubejs/assets/tfg/models/block/glacian_wool_frame.json new file mode 100644 index 000000000..5049b2fcf --- /dev/null +++ b/kubejs/assets/tfg/models/block/glacian_wool_frame.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "tfg:block/glacian_wool_frame" + } +} \ No newline at end of file diff --git a/kubejs/assets/tfg/textures/block/aes_insulation_frame.png b/kubejs/assets/tfg/textures/block/aes_insulation_frame.png new file mode 100644 index 000000000..36dcc891f Binary files /dev/null and b/kubejs/assets/tfg/textures/block/aes_insulation_frame.png differ diff --git a/kubejs/assets/tfg/textures/block/glacian_wool_frame.png b/kubejs/assets/tfg/textures/block/glacian_wool_frame.png new file mode 100644 index 000000000..f8c7f980e Binary files /dev/null and b/kubejs/assets/tfg/textures/block/glacian_wool_frame.png differ diff --git a/kubejs/server_scripts/tfg/events.js b/kubejs/server_scripts/tfg/events.js index c6242903e..1873ff235 100644 --- a/kubejs/server_scripts/tfg/events.js +++ b/kubejs/server_scripts/tfg/events.js @@ -561,6 +561,45 @@ function transformBlockWithTool(event, inputBlock, outputBlock, toolId, damageTo server.runCommandSilent(`execute in ${dim} run setblock ${block.x} ${block.y} ${block.z} ${outputBlock}${state}`); }; +/** + * Function for replacing a block with another block by crouch-right-clicking with a tool and receiving an item. + * + * If input and output is null recipe will just return. + * + * @param {*} event + * @param {string} inputBlock -Block ID to be replaced. Accepts a Tag, but not recommended. + * @param {string} outputBlock -Block ID of the replacement. + * @param {string} outputItem -Item ID of item to receive + * @param {number} outputCount -Number of items to be returned + * @param {string} toolId -Item ID of the tool. + * @param {boolean} damageTool -Sets wether the tool should be damaged on use. + * @param {string} soundId -Sound ID to be used as the flair sound effect. Can be null. + * @param {string} particleId -SimpleParticleType ID to be used as the flair particle. Can be null. + * @param {boolean} copyBlockstate - Sets wether the blockstate should be copied from the input block to the output block. + */ +function transformBlockWithToolReturn(event, inputBlock, outputBlock, outputItem, outputCount, toolId, damageTool, soundId, particleId, copyBlockstate) { + const { server, item, player, block } = event; + + if (!inputBlock || !outputBlock) return; + + if (inputBlock.startsWith('#')) { + if (!block.hasTag(inputBlock.substring(1))) return; + } else { + if (block.id.toString() !== inputBlock) return; + } + + if (toolId.startsWith('#')) { + if (item.isEmpty() || !player.mainHandItem.hasTag(toolId.substring(1))) return; + } else { + if (item.isEmpty() || player.mainHandItem.id !== toolId) return; + } + + transformBlockWithTool(event, inputBlock, outputBlock, toolId, damageTool, soundId, particleId, copyBlockstate) + + const dim = block.level.name.getString(); + server.runCommandSilent(`execute in ${dim} run summon item ${player.x} ${player.y} ${player.z} {Item:{id:'${outputItem}', Count:${outputCount}b}}`); + +} /** * Function for replacing a block with another block by crouch-right-clicking with an item. * @@ -697,6 +736,14 @@ BlockEvents.rightClicked(event => { transformBlockWithTool(event, c.mossy_wall, c.wall, '#forge:tools/knives', true, 'minecraft:item.axe.wax_off', 'minecraft:item_slime', true); transformBlockWithItem(event, c.mossy_wall, c.wall, 'tfc:groundcover/pumice', true, 1, 'minecraft:item.axe.wax_off', 'minecraft:item_slime', true); } + + //Misc Events + transformBlockWithItem(event, 'gtceu:incoloy_ma_956_frame', 'tfg:glacian_wool_frame', 'tfg:glacian_wool', true, 2, 'block.wool.place', 'minecraft:happy_villager', true); + transformBlockWithToolReturn(event, 'tfg:glacian_wool_frame', 'gtceu:incoloy_ma_956_frame', 'tfg:glacian_wool', 2,'#forge:tools/wire_cutters', true, 'minecraft:block.beehive.shear', 'minecraft:crit', true); + + transformBlockWithItem(event, 'gtceu:incoloy_ma_956_frame', 'tfg:aes_insulation_frame', 'tfg:aes_insulation_roll', true, 1, 'block.wool.place', 'minecraft:happy_villager', true); + transformBlockWithToolReturn(event, 'tfg:aes_insulation_frame', 'gtceu:incoloy_ma_956_frame', 'tfg:aes_insulation_roll', 1, '#forge:tools/wire_cutters', true, 'minecraft:block.beehive.shear', 'minecraft:crit', true); + }); // Makes scythes, hoes, and knives take damage when cutting grass diff --git a/kubejs/startup_scripts/tfg/blocks.js b/kubejs/startup_scripts/tfg/blocks.js index bbc2c6aff..d99058588 100644 --- a/kubejs/startup_scripts/tfg/blocks.js +++ b/kubejs/startup_scripts/tfg/blocks.js @@ -210,6 +210,19 @@ const registerTFGBlocks = (event) => { .tagBlock('minecraft:mineable/pickaxe') .tagBoth('tfg:titanium_concrete') + // #region insulation + event.create('tfg:glacian_wool_frame') + .soundType('copper') + .hardness(4) + .resistance(6) + .tagBlock('minecraft:mineable/pickaxe') + .tagBlock('minecraft:mineable/wrench') + event.create('tfg:aes_insulation_frame') + .soundType('copper') + .hardness(5) + .resistance(6) + .tagBlock('minecraft:mineable/pickaxe') + .tagBlock('minecraft:mineable/wrench') // #region Decorative vases global.MINECRAFT_DYE_NAMES.forEach(color => {