Added ind sawmill datagen

This commit is contained in:
Ayutac 2022-02-10 20:21:07 +01:00
parent c928c2b790
commit ee17fe58d8
18 changed files with 124 additions and 352 deletions

View file

@ -40,7 +40,7 @@ public final class FluidValue {
private final long rawValue;
private static FluidValue fromMillibuckets(long millibuckets) {
public static FluidValue fromMillibuckets(long millibuckets) {
return new FluidValue(millibuckets * 81);
}

View file

@ -29,6 +29,7 @@ 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.machine.industrial_sawmill.IndustrialSawmillRecipesProvider
import techreborn.datagen.recipes.smelting.SmeltingRecipesProvider
import techreborn.datagen.recipes.crafting.CraftingRecipesProvider
import techreborn.datagen.tags.TRItemTagProvider
@ -47,5 +48,6 @@ class TechRebornDataGen implements DataGeneratorEntrypoint {
fabricDataGenerator.addProvider(GrinderRecipesProvider.&new)
fabricDataGenerator.addProvider(CompressorRecipesProvider.&new)
fabricDataGenerator.addProvider(BlastFurnaceRecipesProvider.&new)
fabricDataGenerator.addProvider(IndustrialSawmillRecipesProvider.&new)
}
}

View file

@ -0,0 +1,56 @@
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.fluid.FluidValue
import reborncore.common.fluid.container.FluidInstance
import techreborn.api.recipe.recipes.IndustrialSawmillRecipe
import techreborn.datagen.recipes.machine.MachineRecipeJsonFactory
import techreborn.init.ModRecipes
class IndustrialSawmillRecipeJsonFactory extends MachineRecipeJsonFactory<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() {
super(ModRecipes.INDUSTRIAL_SAWMILL)
}
static IndustrialSawmillRecipeJsonFactory create() {
return new IndustrialSawmillRecipeJsonFactory()
}
static IndustrialSawmillRecipeJsonFactory create(@DelegatesTo(value = IndustrialSawmillRecipeJsonFactory.class, strategy = Closure.DELEGATE_FIRST) Closure closure) {
def factory = new IndustrialSawmillRecipeJsonFactory()
closure.setDelegate(factory)
closure.call(factory)
return factory
}
@Override
protected IndustrialSawmillRecipe createRecipe(Identifier identifier) {
return new IndustrialSawmillRecipe(type, 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

@ -0,0 +1,64 @@
/*
* 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_sawmill
import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator
import net.minecraft.item.ItemStack
import net.minecraft.item.Items
import net.minecraft.tag.ItemTags
import techreborn.datagen.recipes.TechRebornRecipesProvider
import techreborn.init.TRContent
class IndustrialSawmillRecipesProvider extends TechRebornRecipesProvider {
IndustrialSawmillRecipesProvider(FabricDataGenerator dataGenerator) {
super(dataGenerator)
}
@Override
void generateRecipes() {
[
(ItemTags.ACACIA_LOGS): Items.ACACIA_PLANKS,
(ItemTags.BIRCH_LOGS): Items.BIRCH_PLANKS,
(ItemTags.DARK_OAK_LOGS): Items.DARK_OAK_PLANKS,
(ItemTags.JUNGLE_LOGS): Items.JUNGLE_PLANKS,
(ItemTags.OAK_LOGS): Items.OAK_PLANKS,
(TRContent.RUBBER_LOGS): TRContent.RUBBER_PLANKS,
(ItemTags.SPRUCE_LOGS): Items.SPRUCE_PLANKS
].each {logs, planks ->
offerIndustrialSawmillRecipe {
ingredients logs
outputs new ItemStack(planks,4), new ItemStack(TRContent.Dusts.SAW, 3)
power 40
time 200
fluidAmount 1000 // in millibuckets
}
}
}
def offerIndustrialSawmillRecipe(@DelegatesTo(value = IndustrialSawmillRecipeJsonFactory.class, strategy = Closure.DELEGATE_FIRST) Closure closure) {
IndustrialSawmillRecipeJsonFactory.create(closure).offerTo(exporter)
}
}

View file

@ -110,6 +110,7 @@ public class TRContent {
public static Block REINFORCED_GLASS;
public static Block RUBBER_LEAVES;
public static Block RUBBER_LOG;
public static Tag.Identified<Item> RUBBER_LOGS = TagFactory.ITEM.create(new Identifier(TechReborn.MOD_ID, "rubber_logs"));
public static Block RUBBER_PLANK_SLAB;
public static Block RUBBER_PLANK_STAIR;
public static Block RUBBER_PLANKS;

View file

@ -1,27 +0,0 @@
{
"type": "techreborn:industrial_sawmill",
"power": 40,
"time": 200,
"tank" : {
"fluid": "minecraft:water",
"amount": 1000
},
"ingredients": [
{
"item": "minecraft:acacia_log"
}
],
"results": [
{
"item": "minecraft:acacia_planks",
"count": 4
},
{
"item": "techreborn:saw_dust",
"count": 3
},
{
"item": "minecraft:paper"
}
]
}

View file

@ -1,27 +0,0 @@
{
"type": "techreborn:industrial_sawmill",
"power": 40,
"time": 200,
"tank" : {
"fluid": "minecraft:water",
"amount": 1000
},
"ingredients": [
{
"item": "minecraft:stripped_acacia_log"
}
],
"results": [
{
"item": "minecraft:acacia_planks",
"count": 4
},
{
"item": "techreborn:saw_dust",
"count": 3
},
{
"item": "minecraft:paper"
}
]
}

View file

@ -1,27 +0,0 @@
{
"type": "techreborn:industrial_sawmill",
"power": 40,
"time": 200,
"tank" : {
"fluid": "minecraft:water",
"amount": 1000
},
"ingredients": [
{
"item": "minecraft:birch_log"
}
],
"results": [
{
"item": "minecraft:birch_planks",
"count": 4
},
{
"item": "techreborn:saw_dust",
"count": 3
},
{
"item": "minecraft:paper"
}
]
}

View file

@ -1,27 +0,0 @@
{
"type": "techreborn:industrial_sawmill",
"power": 40,
"time": 200,
"tank" : {
"fluid": "minecraft:water",
"amount": 1000
},
"ingredients": [
{
"item": "minecraft:stripped_birch_log"
}
],
"results": [
{
"item": "minecraft:birch_planks",
"count": 4
},
{
"item": "techreborn:saw_dust",
"count": 3
},
{
"item": "minecraft:paper"
}
]
}

View file

@ -1,27 +0,0 @@
{
"type": "techreborn:industrial_sawmill",
"power": 40,
"time": 200,
"tank" : {
"fluid": "minecraft:water",
"amount": 1000
},
"ingredients": [
{
"item": "minecraft:dark_oak_log"
}
],
"results": [
{
"item": "minecraft:dark_oak_planks",
"count": 4
},
{
"item": "techreborn:saw_dust",
"count": 3
},
{
"item": "minecraft:paper"
}
]
}

View file

@ -1,27 +0,0 @@
{
"type": "techreborn:industrial_sawmill",
"power": 40,
"time": 200,
"tank" : {
"fluid": "minecraft:water",
"amount": 1000
},
"ingredients": [
{
"item": "minecraft:stripped_dark_oak_log"
}
],
"results": [
{
"item": "minecraft:dark_oak_planks",
"count": 4
},
{
"item": "techreborn:saw_dust",
"count": 3
},
{
"item": "minecraft:paper"
}
]
}

View file

@ -1,27 +0,0 @@
{
"type": "techreborn:industrial_sawmill",
"power": 40,
"time": 200,
"tank" : {
"fluid": "minecraft:water",
"amount": 1000
},
"ingredients": [
{
"item": "minecraft:jungle_log"
}
],
"results": [
{
"item": "minecraft:jungle_planks",
"count": 4
},
{
"item": "techreborn:saw_dust",
"count": 3
},
{
"item": "minecraft:paper"
}
]
}

View file

@ -1,27 +0,0 @@
{
"type": "techreborn:industrial_sawmill",
"power": 40,
"time": 200,
"tank" : {
"fluid": "minecraft:water",
"amount": 1000
},
"ingredients": [
{
"item": "minecraft:stripped_jungle_log"
}
],
"results": [
{
"item": "minecraft:jungle_planks",
"count": 4
},
{
"item": "techreborn:saw_dust",
"count": 3
},
{
"item": "minecraft:paper"
}
]
}

View file

@ -1,27 +0,0 @@
{
"type": "techreborn:industrial_sawmill",
"power": 40,
"time": 200,
"tank" : {
"fluid": "minecraft:water",
"amount": 1000
},
"ingredients": [
{
"item": "minecraft:oak_log"
}
],
"results": [
{
"item": "minecraft:oak_planks",
"count": 4
},
{
"item": "techreborn:saw_dust",
"count": 3
},
{
"item": "minecraft:paper"
}
]
}

View file

@ -1,27 +0,0 @@
{
"type": "techreborn:industrial_sawmill",
"power": 40,
"time": 200,
"tank" : {
"fluid": "minecraft:water",
"amount": 1000
},
"ingredients": [
{
"item": "minecraft:stripped_oak_log"
}
],
"results": [
{
"item": "minecraft:oak_planks",
"count": 4
},
{
"item": "techreborn:saw_dust",
"count": 3
},
{
"item": "minecraft:paper"
}
]
}

View file

@ -1,27 +0,0 @@
{
"type": "techreborn:industrial_sawmill",
"power": 40,
"time": 200,
"tank" : {
"fluid": "minecraft:water",
"amount": 1000
},
"ingredients": [
{
"tag": "techreborn:rubber_logs"
}
],
"results": [
{
"item": "techreborn:rubber_planks",
"count": 4
},
{
"item": "techreborn:saw_dust",
"count": 3
},
{
"item": "minecraft:paper"
}
]
}

View file

@ -1,27 +0,0 @@
{
"type": "techreborn:industrial_sawmill",
"power": 40,
"time": 200,
"tank" : {
"fluid": "minecraft:water",
"amount": 1000
},
"ingredients": [
{
"item": "minecraft:spruce_log"
}
],
"results": [
{
"item": "minecraft:spruce_planks",
"count": 4
},
{
"item": "techreborn:saw_dust",
"count": 3
},
{
"item": "minecraft:paper"
}
]
}

View file

@ -1,27 +0,0 @@
{
"type": "techreborn:industrial_sawmill",
"power": 40,
"time": 200,
"tank" : {
"fluid": "minecraft:water",
"amount": 1000
},
"ingredients": [
{
"item": "minecraft:stripped_spruce_log"
}
],
"results": [
{
"item": "minecraft:spruce_planks",
"count": 4
},
{
"item": "techreborn:saw_dust",
"count": 3
},
{
"item": "minecraft:paper"
}
]
}