Tried adding BlastFurnace recipes, doesn't work yet
This commit is contained in:
parent
4952cee268
commit
af5f1b37c3
4 changed files with 179 additions and 4 deletions
|
@ -26,6 +26,7 @@ package techreborn.datagen
|
|||
|
||||
import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
||||
import techreborn.datagen.recipes.machine.blast_furnace.BlastFurnaceRecipesProvider
|
||||
import techreborn.datagen.recipes.machine.compressor.CompressorRecipesProvider
|
||||
import techreborn.datagen.recipes.machine.grinder.GrinderRecipesProvider
|
||||
import techreborn.datagen.recipes.smelting.SmeltingRecipesProvider
|
||||
|
@ -45,5 +46,6 @@ class TechRebornDataGen implements DataGeneratorEntrypoint {
|
|||
|
||||
fabricDataGenerator.addProvider(GrinderRecipesProvider.&new)
|
||||
fabricDataGenerator.addProvider(CompressorRecipesProvider.&new)
|
||||
fabricDataGenerator.addProvider(BlastFurnaceRecipesProvider.&new)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -176,10 +176,6 @@ class MachineRecipeJsonFactory<R extends RebornRecipe> {
|
|||
throw new IllegalStateException("Recipe has no outputs")
|
||||
}
|
||||
|
||||
if (outputs.size() > 1) {
|
||||
throw new IllegalStateException("Cannot compute default identifier for a recipe with more than one output. TODO might want to improve this?")
|
||||
}
|
||||
|
||||
def outputId = Registry.ITEM.getId(outputs[0].item)
|
||||
return new Identifier("techreborn", "${type.name().path}/${outputId.path}${getSourceAppendix()}")
|
||||
}
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package techreborn.datagen.recipes.machine.blast_furnace
|
||||
|
||||
import net.minecraft.util.Identifier
|
||||
import techreborn.api.recipe.recipes.BlastFurnaceRecipe
|
||||
import techreborn.datagen.recipes.machine.MachineRecipeJsonFactory
|
||||
import techreborn.init.ModRecipes
|
||||
|
||||
class BlastFurnaceRecipeJsonFactory extends MachineRecipeJsonFactory<BlastFurnaceRecipe> {
|
||||
private int heat = -1
|
||||
|
||||
def heat(int heat) {
|
||||
this.heat = heat
|
||||
return this
|
||||
}
|
||||
|
||||
protected BlastFurnaceRecipeJsonFactory() {
|
||||
super(ModRecipes.BLAST_FURNACE)
|
||||
}
|
||||
|
||||
static BlastFurnaceRecipeJsonFactory create() {
|
||||
return new BlastFurnaceRecipeJsonFactory()
|
||||
}
|
||||
|
||||
static BlastFurnaceRecipeJsonFactory create(@DelegatesTo(value = BlastFurnaceRecipeJsonFactory.class, strategy = Closure.DELEGATE_FIRST) Closure closure) {
|
||||
def factory = new BlastFurnaceRecipeJsonFactory()
|
||||
closure.setDelegate(factory)
|
||||
closure.call(factory)
|
||||
return factory
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlastFurnaceRecipe createRecipe(Identifier identifier) {
|
||||
return new BlastFurnaceRecipe(type, identifier, ingredients, outputs, power, time, heat)
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void validate() {
|
||||
super.validate()
|
||||
|
||||
if (heat < 0) {
|
||||
throw new IllegalStateException("recipe has no heat value")
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,133 @@
|
|||
/*
|
||||
* 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.blast_furnace
|
||||
|
||||
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
|
||||
import net.minecraft.item.Item
|
||||
import net.minecraft.item.ItemStack
|
||||
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.machine.MachineRecipeJsonFactory
|
||||
import techreborn.init.ModRecipes
|
||||
import techreborn.init.TRContent
|
||||
|
||||
class BlastFurnaceRecipesProvider extends TechRebornRecipesProvider {
|
||||
|
||||
public final int ARMOR_POWER = 128;
|
||||
public final int ARMOR_TIME = 140;
|
||||
public final int ARMOR_HEAT = 1000;
|
||||
|
||||
BlastFurnaceRecipesProvider(FabricDataGenerator dataGenerator) {
|
||||
super(dataGenerator)
|
||||
}
|
||||
|
||||
@Override
|
||||
void generateRecipes() {
|
||||
generateFromBootsRecipes()
|
||||
generateFromChestplateRecipes()
|
||||
generateFromHelmetRecipes()
|
||||
generateFromLeggingsRecipes()
|
||||
}
|
||||
|
||||
def offerBlastFurnaceRecipe(@DelegatesTo(value = BlastFurnaceRecipeJsonFactory.class, strategy = Closure.DELEGATE_FIRST) Closure closure) {
|
||||
BlastFurnaceRecipeJsonFactory.create(closure).offerTo(exporter)
|
||||
}
|
||||
|
||||
void generateFromBootsRecipes() {
|
||||
final int count = 4;
|
||||
[
|
||||
(Items.DIAMOND_BOOTS) : new ItemStack(Items.DIAMOND, count),
|
||||
(Items.GOLDEN_BOOTS) : new ItemStack(Items.GOLD_INGOT, count),
|
||||
(Items.IRON_BOOTS) : new ItemStack(Items.IRON_INGOT, 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.STEEL_BOOTS) : new ItemStack(TRContent.Ingots.STEEL, count)
|
||||
].each {boots, materialStack ->
|
||||
offerBlastFurnaceRecipe {
|
||||
ingredients boots, Items.SAND
|
||||
outputs materialStack, TRContent.Dusts.DARK_ASHES
|
||||
power ARMOR_POWER
|
||||
time ARMOR_TIME
|
||||
heat ARMOR_HEAT
|
||||
source "boots"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void generateFromChestplateRecipes() {
|
||||
final int count = 8;
|
||||
[
|
||||
(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)
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
void generateFromHelmetRecipes() {
|
||||
final int count = 5;
|
||||
[
|
||||
(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)
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
void generateFromLeggingsRecipes() {
|
||||
final int count = 7;
|
||||
[
|
||||
(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)
|
||||
]
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue