diff --git a/src/datagen/groovy/techreborn/datagen/TRConventionalTags.groovy b/src/datagen/groovy/techreborn/datagen/TRConventionalTags.groovy new file mode 100644 index 000000000..413a60f7d --- /dev/null +++ b/src/datagen/groovy/techreborn/datagen/TRConventionalTags.groovy @@ -0,0 +1,157 @@ +/* + * This file is part of TechReborn, licensed under the MIT License (MIT). + * + * Copyright (c) 2020 TechReborn + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package techreborn.datagen + +import net.minecraft.item.Item +import net.minecraft.registry.RegistryKeys +import net.minecraft.registry.tag.TagKey +import net.minecraft.util.Identifier + +class TRConventionalTags { + public static final TagKey ADVANCED_ALLOY_BLOCKS = register("advanced_alloy_blocks") + public static final TagKey ADVANCED_ALLOY_INGOTS = register("advanced_alloy_ingots") + public static final TagKey ALUMINUM_BLOCKS = register("aluminum_blocks") + public static final TagKey ALUMINUM_DUSTS = register("aluminum_dusts") + public static final TagKey ALUMINUM_INGOTS = register("aluminum_ingots") + public static final TagKey ALUMINUM_PLATES = register("aluminum_plates") + public static final TagKey AMETHYST_DUSTS = register("amethyst_dusts") + public static final TagKey BASALT = register("basalt") + public static final TagKey BAUXITE_DUSTS = register("bauxite_dusts") + public static final TagKey BAUXITE_ORES = register("bauxite_ores") + public static final TagKey BRASS_BLOCKS = register("brass_blocks") + public static final TagKey BRASS_DUSTS = register("brass_dusts") + public static final TagKey BRASS_INGOTS = register("brass_ingots") + public static final TagKey BRONZE_BLOCKS = register("bronze_blocks") + public static final TagKey BRONZE_INGOTS = register("bronze_ingots") + public static final TagKey CALCITE_DUSTS = register("calcite_dusts") + public static final TagKey CALCITE_SMALL_DUSTS = register("calcite_small_dusts") + public static final TagKey CHROMIUM_BLOCKS = register("chromium_blocks") + public static final TagKey CHROMIUM_INGOTS = register("chromium_ingots") + public static final TagKey CINNABAR_ORES = register("cinnabar_ores") + public static final TagKey COAL_DUSTS = register("coal_dusts") + public static final TagKey COAL_ORES = register("coal_ores") + public static final TagKey COOKED_MEAT = register("cooked_meat") + public static final TagKey COPPER_ORES = register("copper_ores") + public static final TagKey COPPER_PLATES = register("copper_plates") + public static final TagKey DEAD_CORAL_BLOCKS = register("dead_coral_blocks") + public static final TagKey DIAMOND_DUSTS = register("diamond_dusts") + public static final TagKey DIAMOND_ORES = register("diamond_ores") + public static final TagKey ELECTRUM_BLOCKS = register("electrum_blocks") + public static final TagKey ELECTRUM_DUSTS = register("electrum_dusts") + public static final TagKey ELECTRUM_INGOTS = register("electrum_ingots") + public static final TagKey ELECTRUM_PLATES = register("electrum_plates") + public static final TagKey EMERALD_DUSTS = register("emerald_dusts") + public static final TagKey EMERALD_ORES = register("emerald_ores") + public static final TagKey EMERALD_PLATES = register("emerald_plates") + public static final TagKey ENDER_PEARL_DUSTS = register("ender_pearl_dusts") + public static final TagKey FROGLIGHTS = register("froglights") + public static final TagKey GALENA_ORES = register("galena_ores") + public static final TagKey GLOWSTONE_SMALL_DUSTS = register("glowstone_small_dusts") + public static final TagKey GOLD_ORES = register("gold_ores") + public static final TagKey INVAR_BLOCKS = register("invar_blocks") + public static final TagKey INVAR_INGOTS = register("invar_ingots") + public static final TagKey IRIDIUM_BLOCKS = register("iridium_blocks") + public static final TagKey IRIDIUM_INGOTS = register("iridium_ingots") + public static final TagKey IRIDIUM_ORES = register("iridium_ores") + public static final TagKey IRON_ORES = register("iron_ores") + public static final TagKey LAPIS_ORES = register("lapis_ores") + public static final TagKey LAZURITE_DUSTS = register("lazurite_dusts") + public static final TagKey LEAD_BLOCKS = register("lead_blocks") + public static final TagKey LEAD_INGOTS = register("lead_ingots") + public static final TagKey LEAD_ORES = register("lead_ores") + public static final TagKey NETHERITE_NUGGETS = register("netherite_nuggets") + public static final TagKey NICKEL_BLOCKS = register("nickel_blocks") + public static final TagKey NICKEL_INGOTS = register("nickel_ingots") + public static final TagKey OBSIDIAN_DUSTS = register("obsidian_dusts") + public static final TagKey PERIDOT_BLOCKS = register("peridot_blocks") + public static final TagKey PERIDOT_DUSTS = register("peridot_dusts") + public static final TagKey PERIDOT_GEMS = register("peridot_gems") + public static final TagKey PERIDOT_ORES = register("peridot_ores") + public static final TagKey PERIDOT_PLATES = register("peridot_plates") + public static final TagKey PLATINUM_BLOCKS = register("platinum_blocks") + public static final TagKey PLATINUM_DUSTS = register("platinum_dusts") + public static final TagKey PLATINUM_INGOTS = register("platinum_ingots") + public static final TagKey PLATINUM_PLATES = register("platinum_plates") + public static final TagKey PYRITE_ORES = register("pyrite_ores") + public static final TagKey QUARTZ_DUSTS = register("quartz_dusts") + public static final TagKey RAW_LEAD_ORES = register("raw_lead_ores") + public static final TagKey RAW_MEAT = register("raw_meat") + public static final TagKey RAW_SILVER_ORES = register("raw_silver_ores") + public static final TagKey RAW_TIN_ORES = register("raw_tin_ores") + public static final TagKey RAW_TUNGSTEN_ORES = register("raw_tungsten_ores") + public static final TagKey RED_GARNET_BLOCKS = register("red_garnet_blocks") + public static final TagKey RED_GARNET_DUSTS = register("red_garnet_dusts") + public static final TagKey RED_GARNET_GEMS = register("red_garnet_gems") + public static final TagKey REDSTONE_ORES = register("redstone_ores") + public static final TagKey REFINED_IRON_BLOCKS = register("refined_iron_blocks") + public static final TagKey REFINED_IRON_INGOTS = register("refined_iron_ingots") + public static final TagKey RUBIES = register("rubies") + public static final TagKey RUBY_BLOCKS = register("ruby_blocks") + public static final TagKey RUBY_DUSTS = register("ruby_dusts") + public static final TagKey RUBY_ORES = register("ruby_ores") + public static final TagKey SAPPHIRE_BLOCKS = register("sapphire_blocks") + public static final TagKey SAPPHIRE_DUSTS = register("sapphire_dusts") + public static final TagKey SAPPHIRE_ORES = register("sapphire_ores") + public static final TagKey SAPPHIRES = register("sapphires") + public static final TagKey SAW_DUSTS = register("saw_dusts") + public static final TagKey SHELDONITE_ORES = register("sheldonite_ores") + public static final TagKey SILICON_PLATES = register("silicon_plates") + public static final TagKey SILVER_BLOCKS = register("silver_blocks") + public static final TagKey SILVER_INGOTS = register("silver_ingots") + public static final TagKey SILVER_ORES = register("silver_ores") + public static final TagKey SMALL_CORALS_BLUE = register("small_corals_blue") + public static final TagKey SMALL_CORALS_DEAD = register("small_corals_dead") + public static final TagKey SMALL_CORALS_PINK = register("small_corals_pink") + public static final TagKey SMALL_CORALS_PURPLE = register("small_corals_purple") + public static final TagKey SMALL_CORALS_RED = register("small_corals_red") + public static final TagKey SMALL_CORALS_YELLOW = register("small_corals_yellow") + public static final TagKey SODALITE_ORES = register("sodalite_ores") + public static final TagKey SPHALERITE_ORES = register("sphalerite_ores") + public static final TagKey SPONGES = register("sponges") + public static final TagKey STEEL_BLOCKS = register("steel_blocks") + public static final TagKey STEEL_DUSTS = register("steel_dusts") + public static final TagKey STEEL_INGOTS = register("steel_ingots") + public static final TagKey TIN_BLOCKS = register("tin_blocks") + public static final TagKey TIN_INGOTS = register("tin_ingots") + public static final TagKey TIN_ORES = register("tin_ores") + public static final TagKey TITANIUM_BLOCKS = register("titanium_blocks") + public static final TagKey TITANIUM_DUSTS = register("titanium_dusts") + public static final TagKey TITANIUM_INGOTS = register("titanium_ingots") + public static final TagKey TUNGSTEN_BLOCKS = register("tungsten_blocks") + public static final TagKey TUNGSTEN_INGOTS = register("tungsten_ingots") + public static final TagKey TUNGSTEN_ORES = register("tungsten_ores") + public static final TagKey TUNGSTENSTEEL_BLOCKS = register("tungstensteel_blocks") + public static final TagKey TUNGSTENSTEEL_INGOTS = register("tungstensteel_ingots") + public static final TagKey YELLOW_GARNET_BLOCKS = register("yellow_garnet_blocks") + public static final TagKey YELLOW_GARNET_DUSTS = register("yellow_garnet_dusts") + public static final TagKey YELLOW_GARNET_GEMS = register("yellow_garnet_gems") + public static final TagKey ZINC_BLOCKS = register("zinc_blocks") + public static final TagKey ZINC_DUSTS = register("zinc_dusts") + public static final TagKey ZINC_INGOTS = register("zinc_ingots") + + private static TagKey register(String name) { + return TagKey.of(RegistryKeys.ITEM, new Identifier("c", name)) + } +} diff --git a/src/datagen/groovy/techreborn/datagen/TechRebornDataGen.groovy b/src/datagen/groovy/techreborn/datagen/TechRebornDataGen.groovy index 763168a9d..9cbaaaef0 100644 --- a/src/datagen/groovy/techreborn/datagen/TechRebornDataGen.groovy +++ b/src/datagen/groovy/techreborn/datagen/TechRebornDataGen.groovy @@ -32,6 +32,7 @@ import techreborn.TechReborn import techreborn.datagen.models.BlockLootTableProvider import techreborn.datagen.models.ModelProvider import techreborn.datagen.recipes.crafting.CraftingRecipesProvider +import techreborn.datagen.recipes.machine.alloy_smelter.AlloySmelterRecipesProvider import techreborn.datagen.recipes.machine.assembling_machine.AssemblingMachineRecipesProvider import techreborn.datagen.recipes.machine.blast_furnace.BlastFurnaceRecipesProvider import techreborn.datagen.recipes.machine.chemical_reactor.ChemicalReactorRecipesProvider @@ -73,6 +74,7 @@ class TechRebornDataGen implements DataGeneratorEntrypoint { add BlastFurnaceRecipesProvider::new add IndustrialGrinderRecipesProvider::new add IndustrialSawmillRecipesProvider::new + add AlloySmelterRecipesProvider::new add ModelProvider::new add BlockLootTableProvider::new diff --git a/src/datagen/groovy/techreborn/datagen/recipes/TechRebornRecipesProvider.groovy b/src/datagen/groovy/techreborn/datagen/recipes/TechRebornRecipesProvider.groovy index 1c7ef047c..7468330dc 100644 --- a/src/datagen/groovy/techreborn/datagen/recipes/TechRebornRecipesProvider.groovy +++ b/src/datagen/groovy/techreborn/datagen/recipes/TechRebornRecipesProvider.groovy @@ -127,6 +127,10 @@ abstract class TechRebornRecipesProvider extends FabricRecipeProvider { throw new IllegalArgumentException() } + def offerAlloySmelterRecipe(@DelegatesTo(value = MachineRecipeJsonFactory.class, strategy = Closure.DELEGATE_FIRST) Closure closure) { + MachineRecipeJsonFactory.create(ModRecipes.ALLOY_SMELTER, closure).offerTo(exporter) + } + def offerGrinderRecipe(@DelegatesTo(value = MachineRecipeJsonFactory.class, strategy = Closure.DELEGATE_FIRST) Closure closure) { MachineRecipeJsonFactory.create(ModRecipes.GRINDER, closure).offerTo(exporter) } diff --git a/src/datagen/groovy/techreborn/datagen/recipes/machine/alloy_smelter/AlloySmelterRecipesProvider.groovy b/src/datagen/groovy/techreborn/datagen/recipes/machine/alloy_smelter/AlloySmelterRecipesProvider.groovy new file mode 100644 index 000000000..3f9afef9f --- /dev/null +++ b/src/datagen/groovy/techreborn/datagen/recipes/machine/alloy_smelter/AlloySmelterRecipesProvider.groovy @@ -0,0 +1,79 @@ +/* + * This file is part of TechReborn, licensed under the MIT License (MIT). + * + * Copyright (c) 2020 TechReborn + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package techreborn.datagen.recipes.machine.alloy_smelter + +import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput +import net.minecraft.item.ItemStack +import net.minecraft.item.Items +import net.minecraft.registry.RegistryWrapper +import techreborn.datagen.TRConventionalTags +import techreborn.datagen.recipes.TechRebornRecipesProvider +import techreborn.init.TRContent + +import java.util.concurrent.CompletableFuture + +class AlloySmelterRecipesProvider extends TechRebornRecipesProvider { + AlloySmelterRecipesProvider(FabricDataOutput output, CompletableFuture registriesFuture) { + super(output, registriesFuture) + } + + @Override + void generateRecipes() { + offerAlloySmelterRecipe { + power 6 + time 200 + ingredients new ItemStack(Items.COPPER_INGOT, 3), TRConventionalTags.ZINC_INGOTS + output new ItemStack(TRContent.Ingots.BRASS, 4) + } + + offerAlloySmelterRecipe { + power 6 + time 200 + ingredients new ItemStack(Items.COPPER_INGOT, 3), TRConventionalTags.TIN_INGOTS + output new ItemStack(TRContent.Ingots.BRONZE, 4) + } + + offerAlloySmelterRecipe { + power 6 + time 200 + ingredients Items.GOLD_INGOT, TRConventionalTags.SILVER_INGOTS + output new ItemStack(TRContent.Ingots.ELECTRUM, 2) + } + + offerAlloySmelterRecipe { + power 6 + time 200 + ingredients new ItemStack(Items.IRON_INGOT, 3), TRConventionalTags.NICKEL_INGOTS + output new ItemStack(TRContent.Ingots.INVAR, 3) + } + + offerAlloySmelterRecipe { + power 6 + time 600 + ingredients new ItemStack(Items.GOLD_INGOT, 10), new ItemStack(Items.NETHERITE_SCRAP, 10) + output new ItemStack(Items.NETHERITE_INGOT, 3) + } + } +} diff --git a/src/datagen/groovy/techreborn/datagen/recipes/machine/grinder/GrinderRecipesProvider.groovy b/src/datagen/groovy/techreborn/datagen/recipes/machine/grinder/GrinderRecipesProvider.groovy index eab2ba858..20a4864b6 100644 --- a/src/datagen/groovy/techreborn/datagen/recipes/machine/grinder/GrinderRecipesProvider.groovy +++ b/src/datagen/groovy/techreborn/datagen/recipes/machine/grinder/GrinderRecipesProvider.groovy @@ -33,6 +33,7 @@ import net.minecraft.registry.RegistryWrapper import net.minecraft.registry.tag.ItemTags import net.minecraft.registry.tag.TagKey import net.minecraft.util.Identifier +import techreborn.datagen.TRConventionalTags import techreborn.datagen.recipes.TechRebornRecipesProvider import techreborn.init.TRContent @@ -61,9 +62,9 @@ class GrinderRecipesProvider extends TechRebornRecipesProvider { void generateVanillaRawMetals() { [ - (Items.RAW_IRON) : (TagKey.of(RegistryKeys.ITEM, new Identifier("c", "iron_ores"))), - (Items.RAW_COPPER): (TagKey.of(RegistryKeys.ITEM, new Identifier("c", "copper_ores"))), - (Items.RAW_GOLD) : (TagKey.of(RegistryKeys.ITEM, new Identifier("c", "gold_ores"))) + (Items.RAW_IRON) : (TRConventionalTags.IRON_ORES), + (Items.RAW_COPPER): (TRConventionalTags.COPPER_ORES), + (Items.RAW_GOLD) : (TRConventionalTags.GOLD_ORES) ].each { raw, oreTag -> offerGrinderRecipe { ingredients oreTag diff --git a/src/main/resources/data/techreborn/recipes/alloy_smelter/brass_ingot.json b/src/main/resources/data/techreborn/recipes/alloy_smelter/brass_ingot.json deleted file mode 100644 index 57bd58a4f..000000000 --- a/src/main/resources/data/techreborn/recipes/alloy_smelter/brass_ingot.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "techreborn:alloy_smelter", - "power": 6, - "time": 200, - "ingredients": [ - { - "count": 3, - "item": "minecraft:copper_ingot" - }, - { - "tag": "c:zinc_ingots" - } - ], - "results": [ - { - "item": "techreborn:brass_ingot", - "count": 4 - } - ] -} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/recipes/alloy_smelter/bronze_ingot.json b/src/main/resources/data/techreborn/recipes/alloy_smelter/bronze_ingot.json deleted file mode 100644 index c4a5c5714..000000000 --- a/src/main/resources/data/techreborn/recipes/alloy_smelter/bronze_ingot.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "techreborn:alloy_smelter", - "power": 6, - "time": 200, - "ingredients": [ - { - "tag": "c:tin_ingots" - }, - { - "count": 3, - "item": "minecraft:copper_ingot" - } - ], - "results": [ - { - "item": "techreborn:bronze_ingot", - "count": 4 - } - ] -} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/recipes/alloy_smelter/electrum_ingot.json b/src/main/resources/data/techreborn/recipes/alloy_smelter/electrum_ingot.json deleted file mode 100644 index 6b107c29b..000000000 --- a/src/main/resources/data/techreborn/recipes/alloy_smelter/electrum_ingot.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "type": "techreborn:alloy_smelter", - "power": 6, - "time": 200, - "ingredients": [ - { - "item": "minecraft:gold_ingot" - }, - { - "tag": "c:silver_ingots" - } - ], - "results": [ - { - "item": "techreborn:electrum_ingot", - "count": 2 - } - ] -} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/recipes/alloy_smelter/invar_ingot.json b/src/main/resources/data/techreborn/recipes/alloy_smelter/invar_ingot.json deleted file mode 100644 index 5298e8781..000000000 --- a/src/main/resources/data/techreborn/recipes/alloy_smelter/invar_ingot.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "type": "techreborn:alloy_smelter", - "power": 6, - "time": 200, - "ingredients" : [ - { - "item": "minecraft:iron_ingot", - "count": 2 - }, - { - "tag": "c:nickel_ingots" - } - ], - "results" : [ - { - "item": "techreborn:invar_ingot", - "count": 3 - } - ] -} \ No newline at end of file diff --git a/src/main/resources/data/techreborn/recipes/alloy_smelter/netherite_ingot.json b/src/main/resources/data/techreborn/recipes/alloy_smelter/netherite_ingot.json deleted file mode 100644 index 411baf5b4..000000000 --- a/src/main/resources/data/techreborn/recipes/alloy_smelter/netherite_ingot.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "type": "techreborn:alloy_smelter", - "power": 6, - "time": 600, - "ingredients" : [ - { - "item": "minecraft:gold_ingot", - "count": 10 - }, - { - "item": "minecraft:netherite_scrap", - "count": 10 - } - ], - "results" : [ - { - "item": "minecraft:netherite_ingot", - "count": 3 - } - ] -} \ No newline at end of file