|
| 1 | +package com.github.gtexpert.gtwp.integration.botania.recipes; |
| 2 | + |
| 3 | +import static gregtech.api.GTValues.*; |
| 4 | +import static gregtech.api.GTValues.LV; |
| 5 | +import static gregtech.api.unification.ore.OrePrefix.dust; |
| 6 | + |
| 7 | +import java.util.Arrays; |
| 8 | +import java.util.List; |
| 9 | + |
| 10 | +import net.minecraft.item.ItemStack; |
| 11 | +import net.minecraft.util.ResourceLocation; |
| 12 | + |
| 13 | +import gregtech.api.recipes.ModHandler; |
| 14 | +import gregtech.api.recipes.RecipeMaps; |
| 15 | +import gregtech.api.unification.material.Materials; |
| 16 | +import gregtech.api.util.GTUtility; |
| 17 | +import gregtech.common.ConfigHolder; |
| 18 | +import gregtech.loaders.WoodTypeEntry; |
| 19 | + |
| 20 | +import com.github.gtexpert.gtwp.api.recipes.GTWPRecipeMaps; |
| 21 | +import com.github.gtexpert.gtwp.api.util.Mods; |
| 22 | +import com.github.gtexpert.gtwp.loaders.GTWPWoodRecipeLoader; |
| 23 | + |
| 24 | +public class BotaniaWoodRecipe { |
| 25 | + |
| 26 | + private static List<WoodTypeEntry> DEFAULT_ENTRIES; |
| 27 | + private static final String mcModId = Mods.Names.BOTANIA; |
| 28 | + |
| 29 | + private static List<WoodTypeEntry> getDefaultEntries() { |
| 30 | + if (DEFAULT_ENTRIES == null) { |
| 31 | + return DEFAULT_ENTRIES = Arrays.asList( |
| 32 | + new WoodTypeEntry.Builder(mcModId, "living_wood") |
| 33 | + .log(Mods.Botania.getItem("livingwood")) |
| 34 | + .planks(Mods.Botania.getItem("livingwood", 1, 1), "livingwood_1") |
| 35 | + .slab(Mods.Botania.getItem("livingwood1slab"), "livingwood1slab_0") |
| 36 | + .stairs(Mods.Botania.getItem("livingwood1stairs"), "livingwood1stairs") |
| 37 | + .registerAllUnificationInfo() |
| 38 | + .build(), |
| 39 | + new WoodTypeEntry.Builder(mcModId, "dream_wood") |
| 40 | + .log(Mods.Botania.getItem("dreamwood")) |
| 41 | + .planks(Mods.Botania.getItem("dreamwood", 1, 1), "dreamwood_1") |
| 42 | + .slab(Mods.Botania.getItem("dreamwood1slab"), "dreamwood1slab_0") |
| 43 | + .stairs(Mods.Botania.getItem("dreamwood1stairs"), "dreamwood1stairs") |
| 44 | + .registerAllUnificationInfo() |
| 45 | + .build()); |
| 46 | + } |
| 47 | + return DEFAULT_ENTRIES; |
| 48 | + } |
| 49 | + |
| 50 | + public static void init() { |
| 51 | + for (WoodTypeEntry entry : getDefaultEntries()) { |
| 52 | + GTWPWoodRecipeLoader.removePlankRecipe(false, entry); |
| 53 | + |
| 54 | + GTWPWoodRecipeLoader.registerWoodTypeRecipe(false, entry); |
| 55 | + GTWPWoodRecipeLoader.addCuttingRecipe(entry); |
| 56 | + GTWPWoodRecipeLoader.addSawmillRecipe(entry); |
| 57 | + } |
| 58 | + |
| 59 | + // log-associated recipes |
| 60 | + String[] woodName = { "livingwood", "dreamwood", "shimmerwoodplanks" }; |
| 61 | + for (String name : woodName) { |
| 62 | + ItemStack wood = Mods.Botania.getItem(name); |
| 63 | + ItemStack stair = Mods.Botania.getItem(name + "0stairs"); |
| 64 | + ItemStack slab = Mods.Botania.getItem(name + "0slab"); |
| 65 | + // stairs |
| 66 | + ModHandler.removeRecipeByName(new ResourceLocation(mcModId, name + "0stairs")); |
| 67 | + |
| 68 | + ModHandler.addShapedRecipe(mcModId + name + "_stairs", GTUtility.copy(4, stair), |
| 69 | + "P ", "PP ", "PPP", |
| 70 | + 'P', wood); |
| 71 | + |
| 72 | + // plank -> stairs assembling |
| 73 | + RecipeMaps.ASSEMBLER_RECIPES.recipeBuilder() |
| 74 | + .inputs(GTUtility.copy(6, wood)) |
| 75 | + .outputs(GTUtility.copy(4, stair)) |
| 76 | + .circuitMeta(7) |
| 77 | + .EUt(1).duration(100).buildAndRegister(); |
| 78 | + |
| 79 | + // Slabs |
| 80 | + // plank -> slab crafting |
| 81 | + ModHandler.addShapedRecipe(mcModId + name + "_slab_saw", GTUtility.copy(2, slab), |
| 82 | + "sS", 'S', wood); |
| 83 | + |
| 84 | + if (ConfigHolder.recipes.hardWoodRecipes) { |
| 85 | + ModHandler.removeRecipeByName(new ResourceLocation(mcModId, name + "0slab_0")); |
| 86 | + } |
| 87 | + |
| 88 | + // plank -> slab cutting |
| 89 | + RecipeMaps.CUTTER_RECIPES.recipeBuilder() |
| 90 | + .inputs(wood.copy()) |
| 91 | + .outputs(GTUtility.copy(2, slab)) |
| 92 | + .duration(200).EUt(VA[ULV]) |
| 93 | + .buildAndRegister(); |
| 94 | + |
| 95 | + GTWPRecipeMaps.SAWMILL_RECIPES.recipeBuilder() |
| 96 | + .circuitMeta(17) |
| 97 | + .inputs(GTUtility.copy(6, wood)) |
| 98 | + .fluidInputs(Materials.Water.getFluid(1000)) |
| 99 | + .outputs(GTUtility.copy(24, slab)) |
| 100 | + .output(dust, Materials.Wood, 12) |
| 101 | + .duration(600).EUt(VA[LV]) |
| 102 | + .buildAndRegister(); |
| 103 | + GTWPRecipeMaps.SAWMILL_RECIPES.recipeBuilder() |
| 104 | + .circuitMeta(18) |
| 105 | + .inputs(GTUtility.copy(6, wood)) |
| 106 | + .fluidInputs(Materials.Water.getFluid(2500)) |
| 107 | + .outputs(GTUtility.copy(36, slab)) |
| 108 | + .duration(800).EUt(VA[LV]) |
| 109 | + .buildAndRegister(); |
| 110 | + GTWPRecipeMaps.SAWMILL_RECIPES.recipeBuilder() |
| 111 | + .circuitMeta(19) |
| 112 | + .inputs(GTUtility.copy(6, wood)) |
| 113 | + .fluidInputs(Materials.DistilledWater.getFluid(600)) |
| 114 | + .outputs(GTUtility.copy(24, slab)) |
| 115 | + .output(dust, Materials.Wood, 12) |
| 116 | + .duration(450).EUt(VA[LV]) |
| 117 | + .buildAndRegister(); |
| 118 | + GTWPRecipeMaps.SAWMILL_RECIPES.recipeBuilder() |
| 119 | + .circuitMeta(20) |
| 120 | + .inputs(GTUtility.copy(6, wood)) |
| 121 | + .fluidInputs(Materials.DistilledWater.getFluid(1500)) |
| 122 | + .outputs(GTUtility.copy(36, slab)) |
| 123 | + .duration(650).EUt(VA[LV]) |
| 124 | + .buildAndRegister(); |
| 125 | + GTWPRecipeMaps.SAWMILL_RECIPES.recipeBuilder() |
| 126 | + .circuitMeta(21) |
| 127 | + .inputs(GTUtility.copy(6, wood)) |
| 128 | + .fluidInputs(Materials.Lubricant.getFluid(120)) |
| 129 | + .outputs(GTUtility.copy(24, slab)) |
| 130 | + .output(dust, Materials.Wood, 12) |
| 131 | + .duration(300).EUt(VA[LV]) |
| 132 | + .buildAndRegister(); |
| 133 | + GTWPRecipeMaps.SAWMILL_RECIPES.recipeBuilder() |
| 134 | + .circuitMeta(22) |
| 135 | + .inputs(GTUtility.copy(6, wood)) |
| 136 | + .fluidInputs(Materials.Lubricant.getFluid(300)) |
| 137 | + .outputs(GTUtility.copy(36, slab)) |
| 138 | + .duration(500).EUt(VA[LV]) |
| 139 | + .buildAndRegister(); |
| 140 | + } |
| 141 | + } |
| 142 | +} |
0 commit comments