Uncrafting Overhaul (#2893)

* Uncrafting Overhaul

Not yet working, some groovy curse I imagine.

new uncrafting recipes:
 - Chestplate (Dia/Ruby/Saph/Peri)
  + Ind.Grinder
   + Water
    -> 4 dusts + 2 small dust
   + Mercury
    -> 6 dusts + 1 small dust
 - Chestplate (Iron/Gold/Bronze/Silver/Steel)
  + Ind.BFurnace
   + Sand
    -> 5 ingots + dark ashes
 - Leggings (Dia/Ruby/Saph/Peri) or Horse Armor (Dia)
  + Ind.Grinder
   + Water
    -> 3 dusts + 2 small dust
   + Mercury
    -> 5 dusts + 1 small dust
 - Leggings (Iron/Gold/Bronze/Silver/Steel) or Horse Armor (Iron/Gold)
  + Ind.BFurnace
   + Sand
    -> 4 ingots + dark ashes
 - Helmet (Dia/Ruby/Saph/Peri)
  + Ind.Grinder
   + Water
    -> 2 dusts + 2 small dust
   + Mercury
    -> 4 dusts + 1 small dust
 - Helmet (Iron/Gold/Bronze/Silver/Steel)
  + Ind.BFurnace
   + Sand
    -> 3 ingots + dark ashes
 - Boots (Dia/Ruby/Saph/Peri)
  + Ind.Grinder
   + Water
    -> 1 dusts + 2 small dust
   + Mercury
    -> 3 dusts + 1 small dust
 - Boots (Iron/Gold/Bronze/Silver/Steel)
  + Ind.BFurnace
   + Sand
    -> 2 ingots + dark ashes
 - Axe or Pickaxe (Dia/Ruby/Saph/Peri)
  + Ind.Grinder
   + Water
    -> 3 small dust + 1 small saw dust
   + Mercury
    -> 1 dust + 3 small dust + 1 small saw dust
 - Axe or Pickaxe (Iron/Gold/Bronze)
  + Ind.BFurnace
   + Sand
    -> 1 ingot + dark ashes
 - Hoe or Sword (Dia/Ruby/Saph/Peri)
  + Ind.Grinder
   + Water
    -> 2 small dust + 1 small saw dust
   + Mercury
    -> 1 dust + 1 small dust + 1 small saw dust
 - Hoe or Sword (Iron/Gold/Bronze)
  + Ind.BFurnace
   + Sand
    -> 5 nuggets + dark ashes
 - Shovel (Dia/Ruby/Saph/Peri)
  + Ind.Grinder
   + Water
    -> 1 small dust + 1 small saw dust
   + Mercury
    -> 2 small dust + 1 small saw dust
 - Shovel (Iron/Gold/Bronze)
  + Ind.BFurnace
   + Sand
    -> 3 nuggets + dark ashes

I also made pickaxe and axe grindable for normal grinder, added a bit more sawdust for them in ind.Sawmill and added treetap to be grinded in industrial sawmill.

* Fix datagen

Co-authored-by: modmuss50 <modmuss50@gmail.com>
This commit is contained in:
Ayutac 2022-04-19 16:27:39 +02:00 committed by GitHub
parent 954882cafc
commit 3c0ad31cce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 609 additions and 83 deletions

View file

@ -188,8 +188,8 @@ dependencies {
disabledOptionalDependency "net.oskarstrom:DashLoader:${project.dashloader_version}" disabledOptionalDependency "net.oskarstrom:DashLoader:${project.dashloader_version}"
// Use groovy for datagen/gametest, if you are copying this you prob dont want it. // Use groovy for datagen/gametest, if you are copying this you prob dont want it.
gametestImplementation 'org.apache.groovy:groovy:4.0.0' gametestImplementation 'org.apache.groovy:groovy:4.0.1'
datagenImplementation 'org.apache.groovy:groovy:4.0.0' datagenImplementation 'org.apache.groovy:groovy:4.0.1'
gametestImplementation ("com.google.truth:truth:1.1.3") { gametestImplementation ("com.google.truth:truth:1.1.3") {
exclude module: "guava" exclude module: "guava"

View file

@ -31,6 +31,7 @@ import techreborn.datagen.recipes.machine.chemical_reactor.ChemicalReactorRecipe
import techreborn.datagen.recipes.machine.compressor.CompressorRecipesProvider import techreborn.datagen.recipes.machine.compressor.CompressorRecipesProvider
import techreborn.datagen.recipes.machine.extractor.ExtractorRecipesProvider import techreborn.datagen.recipes.machine.extractor.ExtractorRecipesProvider
import techreborn.datagen.recipes.machine.grinder.GrinderRecipesProvider 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.machine.industrial_sawmill.IndustrialSawmillRecipesProvider
import techreborn.datagen.recipes.smelting.SmeltingRecipesProvider import techreborn.datagen.recipes.smelting.SmeltingRecipesProvider
import techreborn.datagen.recipes.crafting.CraftingRecipesProvider import techreborn.datagen.recipes.crafting.CraftingRecipesProvider
@ -54,6 +55,7 @@ class TechRebornDataGen implements DataGeneratorEntrypoint {
fabricDataGenerator.addProvider(ExtractorRecipesProvider.&new) fabricDataGenerator.addProvider(ExtractorRecipesProvider.&new)
fabricDataGenerator.addProvider(ChemicalReactorRecipesProvider.&new) fabricDataGenerator.addProvider(ChemicalReactorRecipesProvider.&new)
fabricDataGenerator.addProvider(BlastFurnaceRecipesProvider.&new) fabricDataGenerator.addProvider(BlastFurnaceRecipesProvider.&new)
fabricDataGenerator.addProvider(IndustrialGrinderRecipesProvider.&new)
fabricDataGenerator.addProvider(IndustrialSawmillRecipesProvider.&new) fabricDataGenerator.addProvider(IndustrialSawmillRecipesProvider.&new)
} }
} }

View file

@ -33,7 +33,10 @@ import net.minecraft.recipe.Ingredient
import net.minecraft.tag.TagKey import net.minecraft.tag.TagKey
import net.minecraft.util.Identifier import net.minecraft.util.Identifier
import techreborn.datagen.recipes.machine.MachineRecipeJsonFactory 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 techreborn.init.ModRecipes
import java.util.function.Consumer import java.util.function.Consumer
@ -139,7 +142,19 @@ abstract class TechRebornRecipesProvider extends FabricRecipeProvider {
MachineRecipeJsonFactory.create(ModRecipes.CHEMICAL_REACTOR, closure).offerTo(exporter) 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) { protected Identifier getRecipeIdentifier(Identifier identifier) {
return new Identifier("techreborn", super.getRecipeIdentifier(identifier).path) return new Identifier("techreborn", super.getRecipeIdentifier(identifier).path)
} }

View file

@ -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<R extends RebornFluidRecipe> extends MachineRecipeJsonFactory<R> {
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<R> 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")
}
}

View file

@ -21,7 +21,7 @@ class BlastFurnaceRecipeJsonFactory extends MachineRecipeJsonFactory<BlastFurnac
return new BlastFurnaceRecipeJsonFactory() return new BlastFurnaceRecipeJsonFactory()
} }
static BlastFurnaceRecipeJsonFactory create(@DelegatesTo(value = BlastFurnaceRecipeJsonFactory.class, strategy = Closure.DELEGATE_FIRST) Closure closure) { static BlastFurnaceRecipeJsonFactory createBlastFurnace(@DelegatesTo(value = BlastFurnaceRecipeJsonFactory.class, strategy = Closure.DELEGATE_FIRST) Closure closure) {
def factory = new BlastFurnaceRecipeJsonFactory() def factory = new BlastFurnaceRecipeJsonFactory()
closure.setDelegate(factory) closure.setDelegate(factory)
closure.call(factory) closure.call(factory)

View file

@ -25,16 +25,9 @@
package techreborn.datagen.recipes.machine.blast_furnace package techreborn.datagen.recipes.machine.blast_furnace
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
import net.minecraft.item.Item
import net.minecraft.item.ItemStack import net.minecraft.item.ItemStack
import net.minecraft.item.Items import net.minecraft.item.Items
import reborncore.common.crafting.RebornRecipe
import reborncore.common.crafting.RebornRecipeType
import reborncore.common.misc.TagConvertible
import techreborn.api.recipe.recipes.BlastFurnaceRecipe
import techreborn.datagen.recipes.TechRebornRecipesProvider import techreborn.datagen.recipes.TechRebornRecipesProvider
import techreborn.datagen.recipes.machine.MachineRecipeJsonFactory
import techreborn.init.ModRecipes
import techreborn.init.TRContent import techreborn.init.TRContent
class BlastFurnaceRecipesProvider extends TechRebornRecipesProvider { class BlastFurnaceRecipesProvider extends TechRebornRecipesProvider {
@ -42,6 +35,9 @@ class BlastFurnaceRecipesProvider extends TechRebornRecipesProvider {
public final int ARMOR_POWER = 128 public final int ARMOR_POWER = 128
public final int ARMOR_TIME = 140 public final int ARMOR_TIME = 140
public final int ARMOR_HEAT = 1000 public final int ARMOR_HEAT = 1000
public final int TOOL_POWER = ARMOR_POWER
public final int TOOL_TIME = ARMOR_TIME
public final int TOOL_HEAT = ARMOR_HEAT
BlastFurnaceRecipesProvider(FabricDataGenerator dataGenerator) { BlastFurnaceRecipesProvider(FabricDataGenerator dataGenerator) {
super(dataGenerator) super(dataGenerator)
@ -49,26 +45,24 @@ class BlastFurnaceRecipesProvider extends TechRebornRecipesProvider {
@Override @Override
void generateRecipes() { void generateRecipes() {
generateFromBootsRecipes() generateBoots()
generateFromChestplateRecipes() generateChestplate()
generateFromHelmetRecipes() generateHelmet()
generateFromLeggingsRecipes() generateLeggings()
} generateHorseArmor()
generateSword()
def offerBlastFurnaceRecipe(@DelegatesTo(value = BlastFurnaceRecipeJsonFactory.class, strategy = Closure.DELEGATE_FIRST) Closure closure) { generateShovel()
BlastFurnaceRecipeJsonFactory.create(closure).offerTo(exporter) generateHoe()
generateAxe()
generatePickaxe()
} }
void generateFromBootsRecipes() { void generateBoots() {
final int count = 4 final int count = 2
[ [
(Items.DIAMOND_BOOTS) : new ItemStack(Items.DIAMOND, count),
(Items.GOLDEN_BOOTS) : new ItemStack(Items.GOLD_INGOT, count), (Items.GOLDEN_BOOTS) : new ItemStack(Items.GOLD_INGOT, count),
(Items.IRON_BOOTS) : new ItemStack(Items.IRON_INGOT, count), (Items.IRON_BOOTS) : new ItemStack(Items.IRON_INGOT, count),
(TRContent.BRONZE_BOOTS) : new ItemStack(TRContent.Ingots.BRONZE, count), (TRContent.BRONZE_BOOTS) : new ItemStack(TRContent.Ingots.BRONZE, count),
(TRContent.PERIDOT_BOOTS) : new ItemStack(TRContent.Gems.PERIDOT, count),
(TRContent.RUBY_BOOTS) : new ItemStack(TRContent.Gems.RUBY, count),
(TRContent.SAPPHIRE_BOOTS) : new ItemStack(TRContent.Gems.SAPPHIRE, count),
(TRContent.SILVER_BOOTS) : new ItemStack(TRContent.Ingots.SILVER, count), (TRContent.SILVER_BOOTS) : new ItemStack(TRContent.Ingots.SILVER, count),
(TRContent.STEEL_BOOTS) : new ItemStack(TRContent.Ingots.STEEL, count) (TRContent.STEEL_BOOTS) : new ItemStack(TRContent.Ingots.STEEL, count)
].each {boots, materialStack -> ].each {boots, materialStack ->
@ -84,16 +78,12 @@ class BlastFurnaceRecipesProvider extends TechRebornRecipesProvider {
} }
} }
void generateFromChestplateRecipes() { void generateChestplate() {
final int count = 8 final int count = 5
[ [
(Items.DIAMOND_CHESTPLATE) : new ItemStack(Items.DIAMOND, count),
(Items.GOLDEN_CHESTPLATE) : new ItemStack(Items.GOLD_INGOT, count), (Items.GOLDEN_CHESTPLATE) : new ItemStack(Items.GOLD_INGOT, count),
(Items.IRON_CHESTPLATE) : new ItemStack(Items.IRON_INGOT, count), (Items.IRON_CHESTPLATE) : new ItemStack(Items.IRON_INGOT, count),
(TRContent.BRONZE_CHESTPLATE) : new ItemStack(TRContent.Ingots.BRONZE, 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.SILVER_CHESTPLATE) : new ItemStack(TRContent.Ingots.SILVER, count),
(TRContent.STEEL_CHESTPLATE) : new ItemStack(TRContent.Ingots.STEEL, count) (TRContent.STEEL_CHESTPLATE) : new ItemStack(TRContent.Ingots.STEEL, count)
].each {chestplate, materialStack -> ].each {chestplate, materialStack ->
@ -109,16 +99,12 @@ class BlastFurnaceRecipesProvider extends TechRebornRecipesProvider {
} }
} }
void generateFromHelmetRecipes() { void generateHelmet() {
final int count = 5 final int count = 3
[ [
(Items.DIAMOND_HELMET) : new ItemStack(Items.DIAMOND, count),
(Items.GOLDEN_HELMET) : new ItemStack(Items.GOLD_INGOT, count), (Items.GOLDEN_HELMET) : new ItemStack(Items.GOLD_INGOT, count),
(Items.IRON_HELMET) : new ItemStack(Items.IRON_INGOT, count), (Items.IRON_HELMET) : new ItemStack(Items.IRON_INGOT, count),
(TRContent.BRONZE_HELMET) : new ItemStack(TRContent.Ingots.BRONZE, 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.SILVER_HELMET) : new ItemStack(TRContent.Ingots.SILVER, count),
(TRContent.STEEL_HELMET) : new ItemStack(TRContent.Ingots.STEEL, count) (TRContent.STEEL_HELMET) : new ItemStack(TRContent.Ingots.STEEL, count)
].each {helmet, materialStack -> ].each {helmet, materialStack ->
@ -134,18 +120,14 @@ class BlastFurnaceRecipesProvider extends TechRebornRecipesProvider {
} }
} }
void generateFromLeggingsRecipes() { void generateLeggings() {
final int count = 7 final int count = 4
[ [
(Items.DIAMOND_LEGGINGS) : new ItemStack(Items.DIAMOND, count), (Items.GOLDEN_LEGGINGS) : new ItemStack(Items.GOLD_INGOT, count),
(Items.GOLDEN_LEGGINGS) : new ItemStack(Items.GOLD_INGOT, count), (Items.IRON_LEGGINGS) : new ItemStack(Items.IRON_INGOT, count),
(Items.IRON_LEGGINGS) : new ItemStack(Items.IRON_INGOT, count), (TRContent.BRONZE_LEGGINGS) : new ItemStack(TRContent.Ingots.BRONZE, count),
(TRContent.BRONZE_LEGGINGS) : new ItemStack(TRContent.Ingots.BRONZE, count), (TRContent.SILVER_LEGGINGS) : new ItemStack(TRContent.Ingots.SILVER, count),
(TRContent.PERIDOT_LEGGINGS) : new ItemStack(TRContent.Gems.PERIDOT, count), (TRContent.STEEL_LEGGINGS) : new ItemStack(TRContent.Ingots.STEEL, 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)
].each {leggings, materialStack -> ].each {leggings, materialStack ->
offerBlastFurnaceRecipe { offerBlastFurnaceRecipe {
ingredients leggings, Items.SAND 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)
}
}
}
} }

View file

@ -25,7 +25,6 @@
package techreborn.datagen.recipes.machine.grinder package techreborn.datagen.recipes.machine.grinder
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
import net.minecraft.item.Item
import net.minecraft.item.ItemStack import net.minecraft.item.ItemStack
import net.minecraft.item.Items import net.minecraft.item.Items
import net.minecraft.tag.ItemTags import net.minecraft.tag.ItemTags
@ -235,7 +234,20 @@ class GrinderRecipesProvider extends TechRebornRecipesProvider {
criterion getCriterionName(item), getCriterionConditions(item) 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)
}
}
} }
} }

View file

@ -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<IndustrialGrinderRecipe> {
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)))
}
}

View file

@ -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)
}
}
}
}

View file

@ -3,25 +3,17 @@ package techreborn.datagen.recipes.machine.industrial_sawmill
import net.minecraft.fluid.Fluid import net.minecraft.fluid.Fluid
import net.minecraft.fluid.Fluids import net.minecraft.fluid.Fluids
import net.minecraft.util.Identifier 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.FluidValue
import reborncore.common.fluid.container.FluidInstance import reborncore.common.fluid.container.FluidInstance
import techreborn.api.recipe.recipes.IndustrialSawmillRecipe import techreborn.api.recipe.recipes.IndustrialSawmillRecipe
import techreborn.datagen.recipes.machine.MachineRecipeJsonFactory import techreborn.datagen.recipes.machine.MachineRecipeJsonFactory
import techreborn.datagen.recipes.machine.MachineRecipeWithFluidJsonFactory
import techreborn.init.ModRecipes import techreborn.init.ModRecipes
class IndustrialSawmillRecipeJsonFactory extends MachineRecipeJsonFactory<IndustrialSawmillRecipe> { class IndustrialSawmillRecipeJsonFactory extends MachineRecipeWithFluidJsonFactory<IndustrialSawmillRecipe> {
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
}
protected IndustrialSawmillRecipeJsonFactory() { protected IndustrialSawmillRecipeJsonFactory() {
super(ModRecipes.INDUSTRIAL_SAWMILL) super(ModRecipes.INDUSTRIAL_SAWMILL)
@ -31,7 +23,7 @@ class IndustrialSawmillRecipeJsonFactory extends MachineRecipeJsonFactory<Indust
return new IndustrialSawmillRecipeJsonFactory() return new IndustrialSawmillRecipeJsonFactory()
} }
static IndustrialSawmillRecipeJsonFactory create(@DelegatesTo(value = IndustrialSawmillRecipeJsonFactory.class, strategy = Closure.DELEGATE_FIRST) Closure closure) { static IndustrialSawmillRecipeJsonFactory createIndustrialSawmill(@DelegatesTo(value = IndustrialSawmillRecipeJsonFactory.class, strategy = Closure.DELEGATE_FIRST) Closure closure) {
def factory = new IndustrialSawmillRecipeJsonFactory() def factory = new IndustrialSawmillRecipeJsonFactory()
closure.setDelegate(factory) closure.setDelegate(factory)
closure.call(factory) closure.call(factory)
@ -40,17 +32,6 @@ class IndustrialSawmillRecipeJsonFactory extends MachineRecipeJsonFactory<Indust
@Override @Override
protected IndustrialSawmillRecipe createRecipe(Identifier identifier) { protected IndustrialSawmillRecipe createRecipe(Identifier identifier) {
return new IndustrialSawmillRecipe(type, identifier, ingredients, outputs, power, time, new FluidInstance(fluid, FluidValue.fromMillibuckets(fluidAmount))) return new IndustrialSawmillRecipe(ModRecipes.INDUSTRIAL_SAWMILL, identifier, ingredients, outputs, power, time, new FluidInstance(fluid, FluidValue.fromMillibuckets(fluidAmount)))
}
@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")
} }
} }

View file

@ -122,11 +122,12 @@ class IndustrialSawmillRecipesProvider extends TechRebornRecipesProvider {
} }
[ [
(Items.BOWL) : 2, (Items.BOWL) : 2,
(TRContent.TREE_TAP) : 3,
(Items.WOODEN_SHOVEL) : 2, (Items.WOODEN_SHOVEL) : 2,
(Items.WOODEN_SWORD) : 2, (Items.WOODEN_SWORD) : 2,
(Items.WOODEN_HOE) : 3, (Items.WOODEN_HOE) : 3,
(Items.WOODEN_AXE) : 3, (Items.WOODEN_AXE) : 5,
(Items.WOODEN_PICKAXE): 3 (Items.WOODEN_PICKAXE): 5
].each {item, count -> ].each {item, count ->
offerIndustrialSawmillRecipe { offerIndustrialSawmillRecipe {
ingredients item ingredients item
@ -148,8 +149,4 @@ class IndustrialSawmillRecipesProvider extends TechRebornRecipesProvider {
criterion getCriterionName(ItemTags.WOODEN_BUTTONS), getCriterionConditions(ItemTags.WOODEN_BUTTONS) 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)
}
} }