diff --git a/build.gradle b/build.gradle index 4606636a9..acbe1ed62 100644 --- a/build.gradle +++ b/build.gradle @@ -188,8 +188,8 @@ dependencies { disabledOptionalDependency "net.oskarstrom:DashLoader:${project.dashloader_version}" // Use groovy for datagen/gametest, if you are copying this you prob dont want it. - gametestImplementation 'org.apache.groovy:groovy:4.0.0' - datagenImplementation 'org.apache.groovy:groovy:4.0.0' + gametestImplementation 'org.apache.groovy:groovy:4.0.1' + datagenImplementation 'org.apache.groovy:groovy:4.0.1' gametestImplementation ("com.google.truth:truth:1.1.3") { exclude module: "guava" diff --git a/src/datagen/groovy/techreborn/datagen/TechRebornDataGen.groovy b/src/datagen/groovy/techreborn/datagen/TechRebornDataGen.groovy index f4cc8b9b9..a65ddc42d 100644 --- a/src/datagen/groovy/techreborn/datagen/TechRebornDataGen.groovy +++ b/src/datagen/groovy/techreborn/datagen/TechRebornDataGen.groovy @@ -31,6 +31,7 @@ import techreborn.datagen.recipes.machine.chemical_reactor.ChemicalReactorRecipe import techreborn.datagen.recipes.machine.compressor.CompressorRecipesProvider import techreborn.datagen.recipes.machine.extractor.ExtractorRecipesProvider import techreborn.datagen.recipes.machine.grinder.GrinderRecipesProvider +import techreborn.datagen.recipes.machine.industrial_grinder.IndustrialGrinderRecipesProvider import techreborn.datagen.recipes.machine.industrial_sawmill.IndustrialSawmillRecipesProvider import techreborn.datagen.recipes.smelting.SmeltingRecipesProvider import techreborn.datagen.recipes.crafting.CraftingRecipesProvider @@ -54,6 +55,7 @@ class TechRebornDataGen implements DataGeneratorEntrypoint { fabricDataGenerator.addProvider(ExtractorRecipesProvider.&new) fabricDataGenerator.addProvider(ChemicalReactorRecipesProvider.&new) fabricDataGenerator.addProvider(BlastFurnaceRecipesProvider.&new) + fabricDataGenerator.addProvider(IndustrialGrinderRecipesProvider.&new) fabricDataGenerator.addProvider(IndustrialSawmillRecipesProvider.&new) } } diff --git a/src/datagen/groovy/techreborn/datagen/recipes/TechRebornRecipesProvider.groovy b/src/datagen/groovy/techreborn/datagen/recipes/TechRebornRecipesProvider.groovy index d27f615dd..258135d02 100644 --- a/src/datagen/groovy/techreborn/datagen/recipes/TechRebornRecipesProvider.groovy +++ b/src/datagen/groovy/techreborn/datagen/recipes/TechRebornRecipesProvider.groovy @@ -33,7 +33,10 @@ import net.minecraft.recipe.Ingredient import net.minecraft.tag.TagKey import net.minecraft.util.Identifier import techreborn.datagen.recipes.machine.MachineRecipeJsonFactory - +import techreborn.datagen.recipes.machine.MachineRecipeWithFluidJsonFactory +import techreborn.datagen.recipes.machine.blast_furnace.BlastFurnaceRecipeJsonFactory +import techreborn.datagen.recipes.machine.industrial_grinder.IndustrialGrinderRecipeJsonFactory +import techreborn.datagen.recipes.machine.industrial_sawmill.IndustrialSawmillRecipeJsonFactory import techreborn.init.ModRecipes import java.util.function.Consumer @@ -139,7 +142,19 @@ abstract class TechRebornRecipesProvider extends FabricRecipeProvider { MachineRecipeJsonFactory.create(ModRecipes.CHEMICAL_REACTOR, closure).offerTo(exporter) } - @Override + def offerBlastFurnaceRecipe(@DelegatesTo(value = BlastFurnaceRecipeJsonFactory.class, strategy = Closure.DELEGATE_FIRST) Closure closure) { + BlastFurnaceRecipeJsonFactory.createBlastFurnace(closure).offerTo(exporter) + } + + def offerIndustrialGrinderRecipe(@DelegatesTo(value = IndustrialGrinderRecipeJsonFactory.class, strategy = Closure.DELEGATE_FIRST) Closure closure) { + IndustrialGrinderRecipeJsonFactory.createIndustrialGrinder(closure).offerTo(exporter) + } + + def offerIndustrialSawmillRecipe(@DelegatesTo(value = IndustrialSawmillRecipeJsonFactory.class, strategy = Closure.DELEGATE_FIRST) Closure closure) { + IndustrialSawmillRecipeJsonFactory.createIndustrialSawmill(closure).offerTo(exporter) + } + + @Override protected Identifier getRecipeIdentifier(Identifier identifier) { return new Identifier("techreborn", super.getRecipeIdentifier(identifier).path) } diff --git a/src/datagen/groovy/techreborn/datagen/recipes/machine/MachineRecipeWithFluidJsonFactory.groovy b/src/datagen/groovy/techreborn/datagen/recipes/machine/MachineRecipeWithFluidJsonFactory.groovy new file mode 100644 index 000000000..a164a0cd0 --- /dev/null +++ b/src/datagen/groovy/techreborn/datagen/recipes/machine/MachineRecipeWithFluidJsonFactory.groovy @@ -0,0 +1,36 @@ +package techreborn.datagen.recipes.machine + +import net.minecraft.fluid.Fluid +import net.minecraft.fluid.Fluids +import reborncore.common.crafting.RebornFluidRecipe +import reborncore.common.crafting.RebornRecipeType + +abstract class MachineRecipeWithFluidJsonFactory extends MachineRecipeJsonFactory { + protected Fluid fluid = Fluids.WATER // default + protected long fluidAmount = 1000L // default in millibuckets + + def fluid(Fluid fluid) { + this.fluid = fluid + return this + } + + def fluidAmount(long fluidAmount) { + this.fluidAmount = fluidAmount + return this + } + + protected MachineRecipeWithFluidJsonFactory(RebornRecipeType type) { + super(type) + } + + @Override + protected void validate() { + super.validate() + + if (fluidAmount < 0) { + throw new IllegalStateException("recipe has no valid fluid value specified") + } + if (fluid == null) + throw new IllegalStateException("recipe has no valid fluid type specified") + } +} \ No newline at end of file diff --git a/src/datagen/groovy/techreborn/datagen/recipes/machine/blast_furnace/BlastFurnaceRecipeJsonFactory.groovy b/src/datagen/groovy/techreborn/datagen/recipes/machine/blast_furnace/BlastFurnaceRecipeJsonFactory.groovy index fdfa363ee..8acdfcd4e 100644 --- a/src/datagen/groovy/techreborn/datagen/recipes/machine/blast_furnace/BlastFurnaceRecipeJsonFactory.groovy +++ b/src/datagen/groovy/techreborn/datagen/recipes/machine/blast_furnace/BlastFurnaceRecipeJsonFactory.groovy @@ -21,7 +21,7 @@ class BlastFurnaceRecipeJsonFactory extends MachineRecipeJsonFactory @@ -84,16 +78,12 @@ class BlastFurnaceRecipesProvider extends TechRebornRecipesProvider { } } - void generateFromChestplateRecipes() { - final int count = 8 + void generateChestplate() { + final int count = 5 [ - (Items.DIAMOND_CHESTPLATE) : new ItemStack(Items.DIAMOND, count), (Items.GOLDEN_CHESTPLATE) : new ItemStack(Items.GOLD_INGOT, count), (Items.IRON_CHESTPLATE) : new ItemStack(Items.IRON_INGOT, count), (TRContent.BRONZE_CHESTPLATE) : new ItemStack(TRContent.Ingots.BRONZE, count), - (TRContent.PERIDOT_CHESTPLATE) : new ItemStack(TRContent.Gems.PERIDOT, count), - (TRContent.RUBY_CHESTPLATE) : new ItemStack(TRContent.Gems.RUBY, count), - (TRContent.SAPPHIRE_CHESTPLATE) : new ItemStack(TRContent.Gems.SAPPHIRE, count), (TRContent.SILVER_CHESTPLATE) : new ItemStack(TRContent.Ingots.SILVER, count), (TRContent.STEEL_CHESTPLATE) : new ItemStack(TRContent.Ingots.STEEL, count) ].each {chestplate, materialStack -> @@ -109,16 +99,12 @@ class BlastFurnaceRecipesProvider extends TechRebornRecipesProvider { } } - void generateFromHelmetRecipes() { - final int count = 5 + void generateHelmet() { + final int count = 3 [ - (Items.DIAMOND_HELMET) : new ItemStack(Items.DIAMOND, count), (Items.GOLDEN_HELMET) : new ItemStack(Items.GOLD_INGOT, count), (Items.IRON_HELMET) : new ItemStack(Items.IRON_INGOT, count), (TRContent.BRONZE_HELMET) : new ItemStack(TRContent.Ingots.BRONZE, count), - (TRContent.PERIDOT_HELMET) : new ItemStack(TRContent.Gems.PERIDOT, count), - (TRContent.RUBY_HELMET) : new ItemStack(TRContent.Gems.RUBY, count), - (TRContent.SAPPHIRE_HELMET) : new ItemStack(TRContent.Gems.SAPPHIRE, count), (TRContent.SILVER_HELMET) : new ItemStack(TRContent.Ingots.SILVER, count), (TRContent.STEEL_HELMET) : new ItemStack(TRContent.Ingots.STEEL, count) ].each {helmet, materialStack -> @@ -134,18 +120,14 @@ class BlastFurnaceRecipesProvider extends TechRebornRecipesProvider { } } - void generateFromLeggingsRecipes() { - final int count = 7 + void generateLeggings() { + final int count = 4 [ - (Items.DIAMOND_LEGGINGS) : new ItemStack(Items.DIAMOND, count), - (Items.GOLDEN_LEGGINGS) : new ItemStack(Items.GOLD_INGOT, count), - (Items.IRON_LEGGINGS) : new ItemStack(Items.IRON_INGOT, count), - (TRContent.BRONZE_LEGGINGS) : new ItemStack(TRContent.Ingots.BRONZE, count), - (TRContent.PERIDOT_LEGGINGS) : new ItemStack(TRContent.Gems.PERIDOT, count), - (TRContent.RUBY_LEGGINGS) : new ItemStack(TRContent.Gems.RUBY, count), - (TRContent.SAPPHIRE_LEGGINGS) : new ItemStack(TRContent.Gems.SAPPHIRE, count), - (TRContent.SILVER_LEGGINGS) : new ItemStack(TRContent.Ingots.SILVER, count), - (TRContent.STEEL_LEGGINGS) : new ItemStack(TRContent.Ingots.STEEL, count) + (Items.GOLDEN_LEGGINGS) : new ItemStack(Items.GOLD_INGOT, count), + (Items.IRON_LEGGINGS) : new ItemStack(Items.IRON_INGOT, count), + (TRContent.BRONZE_LEGGINGS) : new ItemStack(TRContent.Ingots.BRONZE, count), + (TRContent.SILVER_LEGGINGS) : new ItemStack(TRContent.Ingots.SILVER, count), + (TRContent.STEEL_LEGGINGS) : new ItemStack(TRContent.Ingots.STEEL, count) ].each {leggings, materialStack -> offerBlastFurnaceRecipe { ingredients leggings, Items.SAND @@ -158,4 +140,117 @@ class BlastFurnaceRecipesProvider extends TechRebornRecipesProvider { } } } + + void generateHorseArmor() { + final int count = 4 + [ + (Items.GOLDEN_HORSE_ARMOR) : new ItemStack(Items.GOLD_INGOT, count), + (Items.IRON_HORSE_ARMOR) : new ItemStack(Items.IRON_INGOT, count) + ].each {horseArmor, materialStack -> + offerBlastFurnaceRecipe { + ingredients horseArmor, Items.SAND + outputs materialStack, TRContent.Dusts.DARK_ASHES + power ARMOR_POWER + time ARMOR_TIME + heat ARMOR_HEAT + source "horse_armor" + criterion getCriterionName(horseArmor), getCriterionConditions(horseArmor) + } + } + } + + void generateSword() { + final int count = 5 + [ + (Items.GOLDEN_SWORD) : new ItemStack(Items.GOLD_NUGGET, count), + (Items.IRON_SWORD) : new ItemStack(Items.IRON_NUGGET, count), + (TRContent.BRONZE_SWORD) : new ItemStack(TRContent.Nuggets.BRONZE, count) + ].each {sword, materialStack -> + offerBlastFurnaceRecipe { + ingredients sword, Items.SAND + outputs materialStack, TRContent.Dusts.DARK_ASHES + power TOOL_POWER + time TOOL_TIME + heat TOOL_HEAT + source "sword" + criterion getCriterionName(sword), getCriterionConditions(sword) + } + } + } + + void generateShovel() { + final int count = 3 + [ + (Items.GOLDEN_SHOVEL) : new ItemStack(Items.GOLD_NUGGET, count), + (Items.IRON_SHOVEL) : new ItemStack(Items.IRON_NUGGET, count), + (TRContent.BRONZE_SPADE) : new ItemStack(TRContent.Nuggets.BRONZE, count) + ].each {shovel, materialStack -> + offerBlastFurnaceRecipe { + ingredients shovel, Items.SAND + outputs materialStack, TRContent.Dusts.DARK_ASHES + power TOOL_POWER + time TOOL_TIME + heat TOOL_HEAT + source "shovel" + criterion getCriterionName(shovel), getCriterionConditions(shovel) + } + } + } + + void generateHoe() { + final int count = 5 + [ + (Items.GOLDEN_HOE) : new ItemStack(Items.GOLD_NUGGET, count), + (Items.IRON_HOE) : new ItemStack(Items.IRON_NUGGET, count), + (TRContent.BRONZE_HOE) : new ItemStack(TRContent.Nuggets.BRONZE, count) + ].each {hoe, materialStack -> + offerBlastFurnaceRecipe { + ingredients hoe, Items.SAND + outputs materialStack, TRContent.Dusts.DARK_ASHES + power TOOL_POWER + time TOOL_TIME + heat TOOL_HEAT + source "hoe" + criterion getCriterionName(hoe), getCriterionConditions(hoe) + } + } + } + + void generateAxe() { + final int count = 1 + [ + (Items.GOLDEN_AXE) : new ItemStack(Items.GOLD_INGOT, count), + (Items.IRON_AXE) : new ItemStack(Items.IRON_INGOT, count), + (TRContent.BRONZE_AXE) : new ItemStack(TRContent.Ingots.BRONZE, count) + ].each {axe, materialStack -> + offerBlastFurnaceRecipe { + ingredients axe, Items.SAND + outputs materialStack, TRContent.Dusts.DARK_ASHES + power TOOL_POWER + time TOOL_TIME + heat TOOL_HEAT + source "axe" + criterion getCriterionName(axe), getCriterionConditions(axe) + } + } + } + + void generatePickaxe() { + final int count = 1 + [ + (Items.GOLDEN_PICKAXE) : new ItemStack(Items.GOLD_INGOT, count), + (Items.IRON_PICKAXE) : new ItemStack(Items.IRON_INGOT, count), + (TRContent.BRONZE_PICKAXE) : new ItemStack(TRContent.Ingots.BRONZE, count) + ].each {pickaxe, materialStack -> + offerBlastFurnaceRecipe { + ingredients pickaxe, Items.SAND + outputs materialStack, TRContent.Dusts.DARK_ASHES + power TOOL_POWER + time TOOL_TIME + heat TOOL_HEAT + source "pickaxe" + criterion getCriterionName(pickaxe), getCriterionConditions(pickaxe) + } + } + } } \ No newline at end of file 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 a25a06f70..fb38fbe79 100644 --- a/src/datagen/groovy/techreborn/datagen/recipes/machine/grinder/GrinderRecipesProvider.groovy +++ b/src/datagen/groovy/techreborn/datagen/recipes/machine/grinder/GrinderRecipesProvider.groovy @@ -25,7 +25,6 @@ package techreborn.datagen.recipes.machine.grinder import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator -import net.minecraft.item.Item import net.minecraft.item.ItemStack import net.minecraft.item.Items import net.minecraft.tag.ItemTags @@ -235,7 +234,20 @@ class GrinderRecipesProvider extends TechRebornRecipesProvider { criterion getCriterionName(item), getCriterionConditions(item) } } - // wooden buttons and wooden tools are not eligible + // wooden buttons and most wooden tools are not eligible because they give too less + [ + (Items.WOODEN_PICKAXE) : 1, + (Items.WOODEN_AXE) : 1 + ].each { item, count -> + offerGrinderRecipe { + ingredients item + outputs new ItemStack(TRContent.SmallDusts.SAW, count) + power 3 + time 180 + source item.toString() + criterion getCriterionName(item), getCriterionConditions(item) + } + } } } \ No newline at end of file diff --git a/src/datagen/groovy/techreborn/datagen/recipes/machine/industrial_grinder/IndustrialGrinderRecipeJsonFactory.groovy b/src/datagen/groovy/techreborn/datagen/recipes/machine/industrial_grinder/IndustrialGrinderRecipeJsonFactory.groovy new file mode 100644 index 000000000..66777cc8b --- /dev/null +++ b/src/datagen/groovy/techreborn/datagen/recipes/machine/industrial_grinder/IndustrialGrinderRecipeJsonFactory.groovy @@ -0,0 +1,34 @@ +package techreborn.datagen.recipes.machine.industrial_grinder + + +import net.minecraft.util.Identifier +import reborncore.common.fluid.FluidValue +import reborncore.common.fluid.container.FluidInstance +import techreborn.api.recipe.recipes.IndustrialGrinderRecipe +import techreborn.api.recipe.recipes.IndustrialSawmillRecipe +import techreborn.datagen.recipes.machine.MachineRecipeJsonFactory +import techreborn.datagen.recipes.machine.MachineRecipeWithFluidJsonFactory +import techreborn.init.ModRecipes + +class IndustrialGrinderRecipeJsonFactory extends MachineRecipeWithFluidJsonFactory { + + protected IndustrialGrinderRecipeJsonFactory() { + super(ModRecipes.INDUSTRIAL_GRINDER) + } + + static IndustrialGrinderRecipeJsonFactory create() { + return new IndustrialGrinderRecipeJsonFactory() + } + + static IndustrialGrinderRecipeJsonFactory createIndustrialGrinder(@DelegatesTo(value = IndustrialGrinderRecipeJsonFactory.class, strategy = Closure.DELEGATE_FIRST) Closure closure) { + def factory = new IndustrialGrinderRecipeJsonFactory() + closure.setDelegate(factory) + closure.call(factory) + return factory + } + + @Override + protected IndustrialGrinderRecipe createRecipe(Identifier identifier) { + return new IndustrialGrinderRecipe(ModRecipes.INDUSTRIAL_GRINDER, identifier, ingredients, outputs, power, time, new FluidInstance(fluid, FluidValue.fromMillibuckets(fluidAmount))) + } +} \ No newline at end of file diff --git a/src/datagen/groovy/techreborn/datagen/recipes/machine/industrial_grinder/IndustrialGrinderRecipesProvider.groovy b/src/datagen/groovy/techreborn/datagen/recipes/machine/industrial_grinder/IndustrialGrinderRecipesProvider.groovy new file mode 100644 index 000000000..96b603d29 --- /dev/null +++ b/src/datagen/groovy/techreborn/datagen/recipes/machine/industrial_grinder/IndustrialGrinderRecipesProvider.groovy @@ -0,0 +1,354 @@ +/* + * 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.industrial_grinder + +import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator +import net.minecraft.item.ItemStack +import net.minecraft.item.Items +import techreborn.datagen.recipes.TechRebornRecipesProvider +import techreborn.init.ModFluids +import techreborn.init.TRContent + +class IndustrialGrinderRecipesProvider extends TechRebornRecipesProvider { + + public final int ARMOR_POWER = 128 + public final int ARMOR_TIME = 140 + public final long ARMOR_FLUID_AMOUNT = 1000L // in millibuckets + public final int TOOL_POWER = ARMOR_POWER + public final int TOOL_TIME = ARMOR_TIME + public final long TOOL_FLUID_AMOUNT = 500L // in millibuckets + var dustMap = TRContent.SmallDusts.SD2DMap + + IndustrialGrinderRecipesProvider(FabricDataGenerator dataGenerator) { + super(dataGenerator) + } + + @Override + void generateRecipes() { + generateBoots() + generateChestplate() + generateHelmet() + generateLeggings() + generateHorseArmor() + generateSword() + generateShovel() + generateHoe() + generateAxe() + generatePickaxe() + } + + void generateBoots() { + final int count = 2 + [ + (Items.DIAMOND_BOOTS) : TRContent.SmallDusts.DIAMOND, + (TRContent.PERIDOT_BOOTS) : TRContent.SmallDusts.PERIDOT, + (TRContent.RUBY_BOOTS) : TRContent.SmallDusts.RUBY, + (TRContent.SAPPHIRE_BOOTS) : TRContent.SmallDusts.SAPPHIRE + ].each {boots, smallDust -> + offerIndustrialGrinderRecipe { + ingredients boots + outputs new ItemStack(dustMap.get(smallDust), count-1), new ItemStack(smallDust, 2) + power ARMOR_POWER + time ARMOR_TIME + fluidAmount ARMOR_FLUID_AMOUNT + source "boots_with_water" + criterion getCriterionName(boots), getCriterionConditions(boots) + } + offerIndustrialGrinderRecipe { + ingredients boots + outputs new ItemStack(dustMap.get(smallDust), count+1), smallDust + power ARMOR_POWER + time ARMOR_TIME + fluidAmount ARMOR_FLUID_AMOUNT + fluid ModFluids.MERCURY.getFluid() + source "boots_with_mercury" + criterion getCriterionName(boots), getCriterionConditions(boots) + } + } + } + + void generateChestplate() { + final int count = 5 + [ + (Items.DIAMOND_CHESTPLATE) : TRContent.SmallDusts.DIAMOND, + (TRContent.PERIDOT_CHESTPLATE) : TRContent.SmallDusts.PERIDOT, + (TRContent.RUBY_CHESTPLATE) : TRContent.SmallDusts.RUBY, + (TRContent.SAPPHIRE_CHESTPLATE) : TRContent.SmallDusts.SAPPHIRE + ].each {chestplate, smallDust -> + offerIndustrialGrinderRecipe { + ingredients chestplate + outputs new ItemStack(dustMap.get(smallDust), count-1), new ItemStack(smallDust, 2) + power ARMOR_POWER + time ARMOR_TIME + fluidAmount ARMOR_FLUID_AMOUNT + source "chestplate_with_water" + criterion getCriterionName(chestplate), getCriterionConditions(chestplate) + } + offerIndustrialGrinderRecipe { + ingredients chestplate + outputs new ItemStack(dustMap.get(smallDust), count+1), smallDust + power ARMOR_POWER + time ARMOR_TIME + fluidAmount ARMOR_FLUID_AMOUNT + fluid ModFluids.MERCURY.getFluid() + source "chestplate_with_mercury" + criterion getCriterionName(chestplate), getCriterionConditions(chestplate) + } + } + } + + void generateHelmet() { + final int count = 3 + [ + (Items.DIAMOND_HELMET) : TRContent.SmallDusts.DIAMOND, + (TRContent.PERIDOT_HELMET) : TRContent.SmallDusts.PERIDOT, + (TRContent.RUBY_HELMET) : TRContent.SmallDusts.RUBY, + (TRContent.SAPPHIRE_HELMET) : TRContent.SmallDusts.SAPPHIRE + ].each {helmet, smallDust -> + offerIndustrialGrinderRecipe { + ingredients helmet + outputs new ItemStack(dustMap.get(smallDust), count-1), new ItemStack(smallDust, 2) + power ARMOR_POWER + time ARMOR_TIME + fluidAmount ARMOR_FLUID_AMOUNT + source "helmet_with_water" + criterion getCriterionName(helmet), getCriterionConditions(helmet) + } + offerIndustrialGrinderRecipe { + ingredients helmet + outputs new ItemStack(dustMap.get(smallDust), count+1), smallDust + power ARMOR_POWER + time ARMOR_TIME + fluidAmount ARMOR_FLUID_AMOUNT + fluid ModFluids.MERCURY.getFluid() + source "helmet_with_mercury" + criterion getCriterionName(helmet), getCriterionConditions(helmet) + } + } + } + + void generateLeggings() { + final int count = 4 + [ + (Items.DIAMOND_LEGGINGS) : TRContent.SmallDusts.DIAMOND, + (TRContent.PERIDOT_LEGGINGS) : TRContent.SmallDusts.PERIDOT, + (TRContent.RUBY_LEGGINGS) : TRContent.SmallDusts.RUBY, + (TRContent.SAPPHIRE_LEGGINGS) : TRContent.SmallDusts.SAPPHIRE + ].each {leggings, smallDust -> + offerIndustrialGrinderRecipe { + ingredients leggings + outputs new ItemStack(dustMap.get(smallDust), count-1), new ItemStack(smallDust, 2) + power ARMOR_POWER + time ARMOR_TIME + fluidAmount ARMOR_FLUID_AMOUNT + source "leggings_with_water" + criterion getCriterionName(leggings), getCriterionConditions(leggings) + } + offerIndustrialGrinderRecipe { + ingredients leggings + outputs new ItemStack(dustMap.get(smallDust), count+1), smallDust + power ARMOR_POWER + time ARMOR_TIME + fluidAmount ARMOR_FLUID_AMOUNT + fluid ModFluids.MERCURY.getFluid() + source "leggings_with_mercury" + criterion getCriterionName(leggings), getCriterionConditions(leggings) + } + } + } + + void generateHorseArmor() { + final int count = 4 + [ + (Items.DIAMOND_HORSE_ARMOR) : TRContent.SmallDusts.DIAMOND + ].each {horseArmor, smallDust -> + offerIndustrialGrinderRecipe { + ingredients horseArmor + outputs new ItemStack(dustMap.get(smallDust), count-1), new ItemStack(smallDust, 2) + power ARMOR_POWER + time ARMOR_TIME + fluidAmount ARMOR_FLUID_AMOUNT + source "horse_armor_with_water" + criterion getCriterionName(horseArmor), getCriterionConditions(horseArmor) + } + offerIndustrialGrinderRecipe { + ingredients horseArmor + outputs new ItemStack(dustMap.get(smallDust), count+1), smallDust + power ARMOR_POWER + time ARMOR_TIME + fluidAmount ARMOR_FLUID_AMOUNT + fluid ModFluids.MERCURY.getFluid() + source "horse_armor_with_mercury" + criterion getCriterionName(horseArmor), getCriterionConditions(horseArmor) + } + } + } + + void generateSword() { + [ + (Items.DIAMOND_SWORD) : TRContent.SmallDusts.DIAMOND, + (TRContent.PERIDOT_SWORD) : TRContent.SmallDusts.PERIDOT, + (TRContent.RUBY_SWORD) : TRContent.SmallDusts.RUBY, + (TRContent.SAPPHIRE_SWORD) : TRContent.SmallDusts.SAPPHIRE + ].each {sword, smallDust -> + offerIndustrialGrinderRecipe { + ingredients sword + outputs new ItemStack(smallDust, 2), TRContent.SmallDusts.SAW + power TOOL_POWER + time TOOL_TIME + fluidAmount TOOL_FLUID_AMOUNT + source "sword_with_water" + criterion getCriterionName(sword), getCriterionConditions(sword) + } + offerIndustrialGrinderRecipe { + ingredients sword + outputs dustMap.get(smallDust), smallDust, TRContent.SmallDusts.SAW + power TOOL_POWER + time TOOL_TIME + fluidAmount TOOL_FLUID_AMOUNT + fluid ModFluids.MERCURY.getFluid() + source "sword_with_mercury" + criterion getCriterionName(sword), getCriterionConditions(sword) + } + } + } + + void generateShovel() { + [ + (Items.DIAMOND_SHOVEL) : TRContent.SmallDusts.DIAMOND, + (TRContent.PERIDOT_SPADE) : TRContent.SmallDusts.PERIDOT, + (TRContent.RUBY_SPADE) : TRContent.SmallDusts.RUBY, + (TRContent.SAPPHIRE_SPADE) : TRContent.SmallDusts.SAPPHIRE + ].each {shovel, smallDust -> + offerIndustrialGrinderRecipe { + ingredients shovel + outputs smallDust, TRContent.SmallDusts.SAW + power TOOL_POWER + time TOOL_TIME + fluidAmount TOOL_FLUID_AMOUNT + source "shovel_with_water" + criterion getCriterionName(shovel), getCriterionConditions(shovel) + } + offerIndustrialGrinderRecipe { + ingredients shovel + outputs new ItemStack(smallDust, 2), TRContent.SmallDusts.SAW + power TOOL_POWER + time TOOL_TIME + fluidAmount TOOL_FLUID_AMOUNT + fluid ModFluids.MERCURY.getFluid() + source "shovel_with_mercury" + criterion getCriterionName(shovel), getCriterionConditions(shovel) + } + } + } + + void generateHoe() { + [ + (Items.DIAMOND_HOE) : TRContent.SmallDusts.DIAMOND, + (TRContent.PERIDOT_HOE) : TRContent.SmallDusts.PERIDOT, + (TRContent.RUBY_HOE) : TRContent.SmallDusts.RUBY, + (TRContent.SAPPHIRE_HOE) : TRContent.SmallDusts.SAPPHIRE + ].each {hoe, smallDust -> + offerIndustrialGrinderRecipe { + ingredients hoe + outputs new ItemStack(smallDust, 2), TRContent.SmallDusts.SAW + power TOOL_POWER + time TOOL_TIME + fluidAmount TOOL_FLUID_AMOUNT + source "hoe_with_water" + criterion getCriterionName(hoe), getCriterionConditions(hoe) + } + offerIndustrialGrinderRecipe { + ingredients hoe + outputs dustMap.get(smallDust), smallDust, TRContent.SmallDusts.SAW + power TOOL_POWER + time TOOL_TIME + fluidAmount TOOL_FLUID_AMOUNT + fluid ModFluids.MERCURY.getFluid() + source "hoe_with_mercury" + criterion getCriterionName(hoe), getCriterionConditions(hoe) + } + } + } + + void generateAxe() { + [ + (Items.DIAMOND_AXE) : TRContent.SmallDusts.DIAMOND, + (TRContent.PERIDOT_AXE) : TRContent.SmallDusts.PERIDOT, + (TRContent.RUBY_AXE) : TRContent.SmallDusts.RUBY, + (TRContent.SAPPHIRE_AXE) : TRContent.SmallDusts.SAPPHIRE + ].each {axe, smallDust -> + offerIndustrialGrinderRecipe { + ingredients axe + outputs new ItemStack(smallDust, 3), TRContent.SmallDusts.SAW + power TOOL_POWER + time TOOL_TIME + fluidAmount TOOL_FLUID_AMOUNT + source "axe_with_water" + criterion getCriterionName(axe), getCriterionConditions(axe) + } + offerIndustrialGrinderRecipe { + ingredients axe + outputs dustMap.get(smallDust), new ItemStack(smallDust, 3), TRContent.SmallDusts.SAW + power TOOL_POWER + time TOOL_TIME + fluidAmount TOOL_FLUID_AMOUNT + fluid ModFluids.MERCURY.getFluid() + source "axe_with_mercury" + criterion getCriterionName(axe), getCriterionConditions(axe) + } + } + } + + void generatePickaxe() { + [ + (Items.DIAMOND_PICKAXE) : TRContent.SmallDusts.DIAMOND, + (TRContent.PERIDOT_PICKAXE) : TRContent.SmallDusts.PERIDOT, + (TRContent.RUBY_PICKAXE) : TRContent.SmallDusts.RUBY, + (TRContent.SAPPHIRE_PICKAXE) : TRContent.SmallDusts.SAPPHIRE + ].each {pickaxe, smallDust -> + offerIndustrialGrinderRecipe { + ingredients pickaxe + outputs new ItemStack(smallDust, 3), TRContent.SmallDusts.SAW + power TOOL_POWER + time TOOL_TIME + fluidAmount TOOL_FLUID_AMOUNT + source "pickaxe_with_water" + criterion getCriterionName(pickaxe), getCriterionConditions(pickaxe) + } + offerIndustrialGrinderRecipe { + ingredients pickaxe + outputs dustMap.get(smallDust), new ItemStack(smallDust, 3), TRContent.SmallDusts.SAW + power TOOL_POWER + time TOOL_TIME + fluidAmount TOOL_FLUID_AMOUNT + fluid ModFluids.MERCURY.getFluid() + source "pickaxe_with_mercury" + criterion getCriterionName(pickaxe), getCriterionConditions(pickaxe) + } + } + } + +} \ No newline at end of file diff --git a/src/datagen/groovy/techreborn/datagen/recipes/machine/industrial_sawmill/IndustrialSawmillRecipeJsonFactory.groovy b/src/datagen/groovy/techreborn/datagen/recipes/machine/industrial_sawmill/IndustrialSawmillRecipeJsonFactory.groovy index 28f925018..f8b7f88c4 100644 --- a/src/datagen/groovy/techreborn/datagen/recipes/machine/industrial_sawmill/IndustrialSawmillRecipeJsonFactory.groovy +++ b/src/datagen/groovy/techreborn/datagen/recipes/machine/industrial_sawmill/IndustrialSawmillRecipeJsonFactory.groovy @@ -3,25 +3,17 @@ package techreborn.datagen.recipes.machine.industrial_sawmill import net.minecraft.fluid.Fluid import net.minecraft.fluid.Fluids import net.minecraft.util.Identifier +import reborncore.common.crafting.RebornFluidRecipe +import reborncore.common.crafting.RebornRecipe +import reborncore.common.crafting.RebornRecipeType import reborncore.common.fluid.FluidValue import reborncore.common.fluid.container.FluidInstance import techreborn.api.recipe.recipes.IndustrialSawmillRecipe import techreborn.datagen.recipes.machine.MachineRecipeJsonFactory +import techreborn.datagen.recipes.machine.MachineRecipeWithFluidJsonFactory import techreborn.init.ModRecipes -class IndustrialSawmillRecipeJsonFactory extends MachineRecipeJsonFactory { - private Fluid fluid = Fluids.WATER // default - private long fluidAmount = -1 - - def fluid(Fluid fluid) { - this.fluid = fluid - return this - } - - def fluidAmount(int fluidAmount) { - this.fluidAmount = fluidAmount - return this - } +class IndustrialSawmillRecipeJsonFactory extends MachineRecipeWithFluidJsonFactory { protected IndustrialSawmillRecipeJsonFactory() { super(ModRecipes.INDUSTRIAL_SAWMILL) @@ -31,7 +23,7 @@ class IndustrialSawmillRecipeJsonFactory extends MachineRecipeJsonFactory offerIndustrialSawmillRecipe { ingredients item @@ -148,8 +149,4 @@ class IndustrialSawmillRecipesProvider extends TechRebornRecipesProvider { criterion getCriterionName(ItemTags.WOODEN_BUTTONS), getCriterionConditions(ItemTags.WOODEN_BUTTONS) } } - - def offerIndustrialSawmillRecipe(@DelegatesTo(value = IndustrialSawmillRecipeJsonFactory.class, strategy = Closure.DELEGATE_FIRST) Closure closure) { - IndustrialSawmillRecipeJsonFactory.create(closure).offerTo(exporter) - } } \ No newline at end of file