From 6d19941d404d97c0a575334e9ee6c4241db4ee62 Mon Sep 17 00:00:00 2001 From: 90 Date: Mon, 27 Nov 2023 15:08:19 +0000 Subject: [PATCH] Add mod loaded condition to all AppBot recipes --- build.gradle.kts | 9 + common/build.gradle.kts | 1 + .../datagen/AppBotHousingRecipeProvider.java | 45 ++++ .../datagen/CommonRecipeProvider.java | 197 +++++++++--------- .../gripe/_90/megacells/core/Platform.java | 10 + .../recipes/cells/mega_mana_cell_housing.json | 24 --- fabric/build.gradle.kts | 9 - .../datagen/FabricRecipeProvider.java | 17 ++ .../megacells/datagen/MEGADataGenerators.java | 2 +- .../_90/megacells/fabric/FabricPlatform.java | 33 +++ forge/build.gradle.kts | 9 - .../datagen/ForgeRecipeProvider.java | 7 +- .../_90/megacells/forge/ForgePlatform.java | 24 +++ 13 files changed, 241 insertions(+), 146 deletions(-) create mode 100644 common/src/data/java/gripe/_90/megacells/datagen/AppBotHousingRecipeProvider.java delete mode 100644 common/src/main/resources/data/megacells/recipes/cells/mega_mana_cell_housing.json create mode 100644 fabric/src/data/java/gripe/_90/megacells/datagen/FabricRecipeProvider.java diff --git a/build.gradle.kts b/build.gradle.kts index 1b12d538..996550a6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -77,6 +77,15 @@ subprojects { } } + maven { + name = "BlameJared" + url = uri("https://maven.blamejared.com") + content { + includeGroup("vazkii.botania") + includeGroup("vazkii.patchouli") + } + } + maven { name = "Modrinth Maven" url = uri("https://api.modrinth.com/maven") diff --git a/common/build.gradle.kts b/common/build.gradle.kts index f2386837..6e5ae064 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -10,4 +10,5 @@ dependencies { modCompileOnly(libs.cloth.fabric) modCompileOnly(libs.ae2wtlib.fabric) modCompileOnly(libs.appbot.fabric) + modCompileOnly(libs.botania.fabric) { isTransitive = false } } diff --git a/common/src/data/java/gripe/_90/megacells/datagen/AppBotHousingRecipeProvider.java b/common/src/data/java/gripe/_90/megacells/datagen/AppBotHousingRecipeProvider.java new file mode 100644 index 00000000..1ce0a9f5 --- /dev/null +++ b/common/src/data/java/gripe/_90/megacells/datagen/AppBotHousingRecipeProvider.java @@ -0,0 +1,45 @@ +package gripe._90.megacells.datagen; + +import java.util.function.Consumer; + +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.data.PackOutput; +import net.minecraft.world.item.crafting.Ingredient; + +import appeng.core.definitions.AEBlocks; +import appeng.core.definitions.AEItems; + +import appbot.AppliedBotanics; + +import gripe._90.megacells.MEGACells; +import gripe._90.megacells.core.Addons; +import gripe._90.megacells.integration.appbot.AppBotItems; + +import vazkii.botania.common.block.block_entity.mana.ManaPoolBlockEntity; +import vazkii.botania.common.item.BotaniaItems; +import vazkii.botania.data.recipes.TerrestrialAgglomerationProvider; + +public class AppBotHousingRecipeProvider extends TerrestrialAgglomerationProvider { + public AppBotHousingRecipeProvider(PackOutput packOutput) { + super(packOutput); + } + + @Override + public void buildRecipes(Consumer writer) { + var housing = AppBotItems.MEGA_MANA_CELL_HOUSING; + var id = MEGACells.makeId("cells/" + housing.id().getPath()); + MEGACells.PLATFORM.addIntegrationRecipe( + writer, + new FinishedRecipe( + id, + ManaPoolBlockEntity.MAX_MANA * 2, + housing.stack(), + Ingredient.of(BuiltInRegistries.ITEM.get(AppliedBotanics.id("mana_cell_housing"))), + Ingredient.of(BotaniaItems.manaPearl), + Ingredient.of(BotaniaItems.manaDiamond), + Ingredient.of(AEItems.SKY_DUST), + Ingredient.of(AEBlocks.QUARTZ_VIBRANT_GLASS)), + Addons.APPBOT, + id); + } +} diff --git a/common/src/data/java/gripe/_90/megacells/datagen/CommonRecipeProvider.java b/common/src/data/java/gripe/_90/megacells/datagen/CommonRecipeProvider.java index 9fd5e3d4..8542beab 100644 --- a/common/src/data/java/gripe/_90/megacells/datagen/CommonRecipeProvider.java +++ b/common/src/data/java/gripe/_90/megacells/datagen/CommonRecipeProvider.java @@ -39,129 +39,126 @@ import gripe._90.megacells.integration.appbot.AppBotItems; public class CommonRecipeProvider extends RecipeProvider { + private final PackOutput output; + public CommonRecipeProvider(PackOutput output) { super(output); + this.output = output; } @Override - public void buildRecipes(Consumer consumer) { - component(consumer, MEGAItems.TIER_1M, StorageTier.SIZE_256K, AEItems.SKY_DUST.asItem(), null); - component(consumer, MEGAItems.TIER_4M, MEGAItems.TIER_1M, null, ConventionTags.ENDER_PEARL_DUST); - component(consumer, MEGAItems.TIER_16M, MEGAItems.TIER_4M, null, ConventionTags.ENDER_PEARL_DUST); - component(consumer, MEGAItems.TIER_64M, MEGAItems.TIER_16M, AEItems.MATTER_BALL.asItem(), null); - component(consumer, MEGAItems.TIER_256M, MEGAItems.TIER_64M, AEItems.MATTER_BALL.asItem(), null); + public void buildRecipes(Consumer writer) { + component(writer, MEGAItems.TIER_1M, StorageTier.SIZE_256K, AEItems.SKY_DUST.asItem(), null); + component(writer, MEGAItems.TIER_4M, MEGAItems.TIER_1M, null, ConventionTags.ENDER_PEARL_DUST); + component(writer, MEGAItems.TIER_16M, MEGAItems.TIER_4M, null, ConventionTags.ENDER_PEARL_DUST); + component(writer, MEGAItems.TIER_64M, MEGAItems.TIER_16M, AEItems.MATTER_BALL.asItem(), null); + component(writer, MEGAItems.TIER_256M, MEGAItems.TIER_64M, AEItems.MATTER_BALL.asItem(), null); - housing(consumer, MEGAItems.MEGA_ITEM_CELL_HOUSING, MEGATags.SKY_STEEL_INGOT); - housing(consumer, MEGAItems.MEGA_FLUID_CELL_HOUSING, ConventionTags.COPPER_INGOT); + housing(writer, MEGAItems.MEGA_ITEM_CELL_HOUSING, MEGATags.SKY_STEEL_INGOT); + housing(writer, MEGAItems.MEGA_FLUID_CELL_HOUSING, ConventionTags.COPPER_INGOT); cell( - consumer, + writer, MEGAItems.ITEM_CELL_1M, MEGAItems.CELL_COMPONENT_1M, MEGAItems.MEGA_ITEM_CELL_HOUSING, ConventionTags.IRON_INGOT); cell( - consumer, + writer, MEGAItems.ITEM_CELL_4M, MEGAItems.CELL_COMPONENT_4M, MEGAItems.MEGA_ITEM_CELL_HOUSING, ConventionTags.IRON_INGOT); cell( - consumer, + writer, MEGAItems.ITEM_CELL_16M, MEGAItems.CELL_COMPONENT_16M, MEGAItems.MEGA_ITEM_CELL_HOUSING, ConventionTags.IRON_INGOT); cell( - consumer, + writer, MEGAItems.ITEM_CELL_64M, MEGAItems.CELL_COMPONENT_64M, MEGAItems.MEGA_ITEM_CELL_HOUSING, ConventionTags.IRON_INGOT); cell( - consumer, + writer, MEGAItems.ITEM_CELL_256M, MEGAItems.CELL_COMPONENT_256M, MEGAItems.MEGA_ITEM_CELL_HOUSING, ConventionTags.IRON_INGOT); cell( - consumer, + writer, MEGAItems.FLUID_CELL_1M, MEGAItems.CELL_COMPONENT_1M, MEGAItems.MEGA_FLUID_CELL_HOUSING, ConventionTags.COPPER_INGOT); cell( - consumer, + writer, MEGAItems.FLUID_CELL_4M, MEGAItems.CELL_COMPONENT_4M, MEGAItems.MEGA_FLUID_CELL_HOUSING, ConventionTags.COPPER_INGOT); cell( - consumer, + writer, MEGAItems.FLUID_CELL_16M, MEGAItems.CELL_COMPONENT_16M, MEGAItems.MEGA_FLUID_CELL_HOUSING, ConventionTags.COPPER_INGOT); cell( - consumer, + writer, MEGAItems.FLUID_CELL_64M, MEGAItems.CELL_COMPONENT_64M, MEGAItems.MEGA_FLUID_CELL_HOUSING, ConventionTags.COPPER_INGOT); cell( - consumer, + writer, MEGAItems.FLUID_CELL_256M, MEGAItems.CELL_COMPONENT_256M, MEGAItems.MEGA_FLUID_CELL_HOUSING, ConventionTags.COPPER_INGOT); portable( - consumer, - MEGAItems.PORTABLE_ITEM_CELL_1M, - MEGAItems.CELL_COMPONENT_1M, - MEGAItems.MEGA_ITEM_CELL_HOUSING); + writer, MEGAItems.PORTABLE_ITEM_CELL_1M, MEGAItems.CELL_COMPONENT_1M, MEGAItems.MEGA_ITEM_CELL_HOUSING); portable( - consumer, - MEGAItems.PORTABLE_ITEM_CELL_4M, - MEGAItems.CELL_COMPONENT_4M, - MEGAItems.MEGA_ITEM_CELL_HOUSING); + writer, MEGAItems.PORTABLE_ITEM_CELL_4M, MEGAItems.CELL_COMPONENT_4M, MEGAItems.MEGA_ITEM_CELL_HOUSING); portable( - consumer, + writer, MEGAItems.PORTABLE_ITEM_CELL_16M, MEGAItems.CELL_COMPONENT_16M, MEGAItems.MEGA_ITEM_CELL_HOUSING); portable( - consumer, + writer, MEGAItems.PORTABLE_ITEM_CELL_64M, MEGAItems.CELL_COMPONENT_64M, MEGAItems.MEGA_ITEM_CELL_HOUSING); portable( - consumer, + writer, MEGAItems.PORTABLE_ITEM_CELL_256M, MEGAItems.CELL_COMPONENT_256M, MEGAItems.MEGA_ITEM_CELL_HOUSING); portable( - consumer, + writer, MEGAItems.PORTABLE_FLUID_CELL_1M, MEGAItems.CELL_COMPONENT_1M, MEGAItems.MEGA_FLUID_CELL_HOUSING); portable( - consumer, + writer, MEGAItems.PORTABLE_FLUID_CELL_4M, MEGAItems.CELL_COMPONENT_4M, MEGAItems.MEGA_FLUID_CELL_HOUSING); portable( - consumer, + writer, MEGAItems.PORTABLE_FLUID_CELL_16M, MEGAItems.CELL_COMPONENT_16M, MEGAItems.MEGA_FLUID_CELL_HOUSING); portable( - consumer, + writer, MEGAItems.PORTABLE_FLUID_CELL_64M, MEGAItems.CELL_COMPONENT_64M, MEGAItems.MEGA_FLUID_CELL_HOUSING); portable( - consumer, + writer, MEGAItems.PORTABLE_FLUID_CELL_256M, MEGAItems.CELL_COMPONENT_256M, MEGAItems.MEGA_FLUID_CELL_HOUSING); @@ -172,14 +169,14 @@ public void buildRecipes(Consumer consumer) { .pattern("###") .define('#', MEGATags.SKY_STEEL_INGOT) .unlockedBy("has_sky_steel_ingot", has(MEGATags.SKY_STEEL_INGOT)) - .save(consumer, MEGACells.makeId("crafting/sky_steel_block")); + .save(writer, MEGACells.makeId("crafting/sky_steel_block")); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, MEGAItems.SKY_STEEL_INGOT, 9) .requires(MEGABlocks.SKY_STEEL_BLOCK) .unlockedBy("has_sky_steel_ingot", has(MEGATags.SKY_STEEL_INGOT)) - .save(consumer, MEGACells.makeId("crafting/sky_steel_ingot_from_sky_steel_block")); + .save(writer, MEGACells.makeId("crafting/sky_steel_ingot_from_sky_steel_block")); TransformRecipeBuilder.transform( - consumer, + writer, MEGACells.makeId("transform/sky_steel_ingot"), MEGAItems.SKY_STEEL_INGOT, 2, @@ -192,21 +189,21 @@ public void buildRecipes(Consumer consumer) { .setTop(Ingredient.of(AEItems.CALCULATION_PROCESSOR_PRESS)) .setBottom(Ingredient.of(AEItems.ENGINEERING_PROCESSOR_PRESS)) .setMode(InscriberProcessType.PRESS) - .save(consumer, MEGACells.makeId("inscriber/accumulation_processor_press")); + .save(writer, MEGACells.makeId("inscriber/accumulation_processor_press")); InscriberRecipeBuilder.inscribe(Items.IRON_BLOCK, MEGAItems.ACCUMULATION_PROCESSOR_PRESS, 1) .setTop(Ingredient.of(MEGAItems.ACCUMULATION_PROCESSOR_PRESS)) .setMode(InscriberProcessType.INSCRIBE) - .save(consumer, MEGACells.makeId("inscriber/accumulation_processor_press_extra")); + .save(writer, MEGACells.makeId("inscriber/accumulation_processor_press_extra")); InscriberRecipeBuilder.inscribe(MEGATags.SKY_STEEL_INGOT, MEGAItems.ACCUMULATION_PROCESSOR_PRINT, 1) .setTop(Ingredient.of(MEGAItems.ACCUMULATION_PROCESSOR_PRESS)) .setMode(InscriberProcessType.INSCRIBE) - .save(consumer, MEGACells.makeId("inscriber/accumulation_processor_print")); + .save(writer, MEGACells.makeId("inscriber/accumulation_processor_print")); InscriberRecipeBuilder.inscribe(ConventionTags.FLUIX_DUST, MEGAItems.ACCUMULATION_PROCESSOR, 1) .setTop(Ingredient.of(MEGAItems.ACCUMULATION_PROCESSOR_PRINT)) .setBottom(Ingredient.of(AEItems.SILICON_PRINT)) .setMode(InscriberProcessType.PRESS) - .save(consumer, MEGACells.makeId("inscriber/accumulation_processor")); + .save(writer, MEGACells.makeId("inscriber/accumulation_processor")); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, MEGAItems.BULK_CELL_COMPONENT) .pattern("aba") @@ -219,7 +216,7 @@ public void buildRecipes(Consumer consumer) { .define('e', MEGAItems.CELL_COMPONENT_1M) .unlockedBy("has_cell_component_1m", has(MEGAItems.CELL_COMPONENT_1M)) .unlockedBy("has_2_cubed_spatial_cell_component", has(AEItems.SPATIAL_2_CELL_COMPONENT)) - .save(consumer, MEGACells.makeId("crafting/bulk_cell_component")); + .save(writer, MEGACells.makeId("crafting/bulk_cell_component")); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, MEGAItems.BULK_ITEM_CELL) .pattern("aba") @@ -230,7 +227,7 @@ public void buildRecipes(Consumer consumer) { .define('c', MEGAItems.BULK_CELL_COMPONENT) .define('d', Items.NETHERITE_INGOT) .unlockedBy("has_bulk_cell_component", has(MEGAItems.BULK_CELL_COMPONENT)) - .save(consumer, MEGACells.makeId("cells/standard/bulk_item_cell")); + .save(writer, MEGACells.makeId("cells/standard/bulk_item_cell")); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, MEGABlocks.MEGA_ENERGY_CELL) .pattern("aaa") @@ -240,7 +237,7 @@ public void buildRecipes(Consumer consumer) { .define('b', MEGAItems.ACCUMULATION_PROCESSOR) .unlockedBy("has_dense_energy_cell", has(AEBlocks.DENSE_ENERGY_CELL)) .unlockedBy("has_accumulation_processor", has(MEGAItems.ACCUMULATION_PROCESSOR)) - .save(consumer, MEGACells.makeId("crafting/mega_energy_cell")); + .save(writer, MEGACells.makeId("crafting/mega_energy_cell")); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, MEGABlocks.MEGA_CRAFTING_UNIT) .pattern("aba") @@ -252,34 +249,34 @@ public void buildRecipes(Consumer consumer) { .define('d', MEGAItems.ACCUMULATION_PROCESSOR) .unlockedBy("has_logic_processor", has(AEItems.LOGIC_PROCESSOR)) .unlockedBy("has_accumulation_processor", has(MEGAItems.ACCUMULATION_PROCESSOR)) - .save(consumer, MEGACells.makeId("crafting/mega_crafting_unit")); - craftingBlock(consumer, MEGABlocks.CRAFTING_ACCELERATOR, AEItems.ENGINEERING_PROCESSOR); - craftingBlock(consumer, MEGABlocks.CRAFTING_STORAGE_1M, MEGAItems.CELL_COMPONENT_1M); - craftingBlock(consumer, MEGABlocks.CRAFTING_STORAGE_4M, MEGAItems.CELL_COMPONENT_4M); - craftingBlock(consumer, MEGABlocks.CRAFTING_STORAGE_16M, MEGAItems.CELL_COMPONENT_16M); - craftingBlock(consumer, MEGABlocks.CRAFTING_STORAGE_64M, MEGAItems.CELL_COMPONENT_64M); - craftingBlock(consumer, MEGABlocks.CRAFTING_STORAGE_256M, MEGAItems.CELL_COMPONENT_256M); - craftingBlock(consumer, MEGABlocks.CRAFTING_MONITOR, AEParts.STORAGE_MONITOR); + .save(writer, MEGACells.makeId("crafting/mega_crafting_unit")); + craftingBlock(writer, MEGABlocks.CRAFTING_ACCELERATOR, AEItems.ENGINEERING_PROCESSOR); + craftingBlock(writer, MEGABlocks.CRAFTING_STORAGE_1M, MEGAItems.CELL_COMPONENT_1M); + craftingBlock(writer, MEGABlocks.CRAFTING_STORAGE_4M, MEGAItems.CELL_COMPONENT_4M); + craftingBlock(writer, MEGABlocks.CRAFTING_STORAGE_16M, MEGAItems.CELL_COMPONENT_16M); + craftingBlock(writer, MEGABlocks.CRAFTING_STORAGE_64M, MEGAItems.CELL_COMPONENT_64M); + craftingBlock(writer, MEGABlocks.CRAFTING_STORAGE_256M, MEGAItems.CELL_COMPONENT_256M); + craftingBlock(writer, MEGABlocks.CRAFTING_MONITOR, AEParts.STORAGE_MONITOR); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, MEGAItems.GREATER_ENERGY_CARD) .requires(AEItems.ADVANCED_CARD) .requires(MEGABlocks.MEGA_ENERGY_CELL) .unlockedBy("has_advanced_card", has(AEItems.ADVANCED_CARD)) .unlockedBy("has_mega_energy_cell", has(MEGABlocks.MEGA_ENERGY_CELL)) - .save(consumer, MEGACells.makeId("crafting/greater_energy_card")); + .save(writer, MEGACells.makeId("crafting/greater_energy_card")); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, MEGAItems.GREATER_ENERGY_CARD) .requires(AEItems.ENERGY_CARD) .requires(MEGABlocks.MEGA_ENERGY_CELL) .unlockedBy("has_advanced_card", has(AEItems.ADVANCED_CARD)) .unlockedBy("has_mega_energy_cell", has(MEGABlocks.MEGA_ENERGY_CELL)) - .save(consumer, MEGACells.makeId("crafting/greater_energy_card_upgraded")); + .save(writer, MEGACells.makeId("crafting/greater_energy_card_upgraded")); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, MEGAItems.COMPRESSION_CARD) .requires(AEItems.ADVANCED_CARD) .requires(AEItems.MATTER_BALL) .unlockedBy("has_advanced_card", has(AEItems.ADVANCED_CARD)) .unlockedBy("has_matter_ball", has(AEItems.MATTER_BALL)) - .save(consumer, MEGACells.makeId("crafting/compression_card")); + .save(writer, MEGACells.makeId("crafting/compression_card")); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, MEGAItems.DECOMPRESSION_MODULE) .pattern("IAI") .pattern("C#E") @@ -292,49 +289,51 @@ public void buildRecipes(Consumer consumer) { .define('#', MEGAItems.COMPRESSION_CARD) .unlockedBy("has_accumulation_processor", has(MEGAItems.ACCUMULATION_PROCESSOR)) .unlockedBy("has_compression_card", has(MEGAItems.COMPRESSION_CARD)) - .save(consumer, MEGACells.makeId("crafting/decompression_module")); + .save(writer, MEGACells.makeId("crafting/decompression_module")); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, MEGABlocks.MEGA_INTERFACE) .requires(AEBlocks.INTERFACE) .requires(MEGAItems.ACCUMULATION_PROCESSOR) .unlockedBy("has_accumulation_processor", has(MEGAItems.ACCUMULATION_PROCESSOR)) .unlockedBy("has_interface", has(ConventionTags.INTERFACE)) - .save(consumer, MEGACells.makeId("network/mega_interface")); + .save(writer, MEGACells.makeId("network/mega_interface")); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, MEGABlocks.MEGA_PATTERN_PROVIDER) .requires(AEBlocks.PATTERN_PROVIDER) .requires(MEGAItems.ACCUMULATION_PROCESSOR) .unlockedBy("has_accumulation_processor", has(MEGAItems.ACCUMULATION_PROCESSOR)) .unlockedBy("has_pattern_provider", has(ConventionTags.PATTERN_PROVIDER)) - .save(consumer, MEGACells.makeId("network/mega_pattern_provider")); + .save(writer, MEGACells.makeId("network/mega_pattern_provider")); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, MEGAItems.MEGA_INTERFACE) .requires(MEGABlocks.MEGA_INTERFACE) .unlockedBy("has_mega_interface", has(MEGABlocks.MEGA_INTERFACE)) - .save(consumer, MEGACells.makeId("network/mega_interface_part")); + .save(writer, MEGACells.makeId("network/mega_interface_part")); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, MEGABlocks.MEGA_INTERFACE) .requires(MEGAItems.MEGA_INTERFACE) .unlockedBy("has_cable_mega_interface", has(MEGAItems.MEGA_INTERFACE)) - .save(consumer, MEGACells.makeId("network/mega_interface_block")); + .save(writer, MEGACells.makeId("network/mega_interface_block")); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, MEGAItems.MEGA_PATTERN_PROVIDER) .requires(MEGABlocks.MEGA_PATTERN_PROVIDER) .unlockedBy("has_mega_pattern_provider", has(MEGABlocks.MEGA_PATTERN_PROVIDER)) - .save(consumer, MEGACells.makeId("network/mega_pattern_provider_part")); + .save(writer, MEGACells.makeId("network/mega_pattern_provider_part")); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, MEGABlocks.MEGA_PATTERN_PROVIDER) .requires(MEGAItems.MEGA_PATTERN_PROVIDER) .unlockedBy("has_cable_mega_pattern_provider", has(MEGAItems.MEGA_PATTERN_PROVIDER)) - .save(consumer, MEGACells.makeId("network/mega_pattern_provider_block")); + .save(writer, MEGACells.makeId("network/mega_pattern_provider_block")); if (MEGACells.PLATFORM.isAddonLoaded(Addons.APPBOT)) { - manaCells(consumer, AppBotItems.MANA_CELL_1M, AppBotItems.PORTABLE_MANA_CELL_1M, MEGAItems.TIER_1M); - manaCells(consumer, AppBotItems.MANA_CELL_4M, AppBotItems.PORTABLE_MANA_CELL_4M, MEGAItems.TIER_4M); - manaCells(consumer, AppBotItems.MANA_CELL_16M, AppBotItems.PORTABLE_MANA_CELL_16M, MEGAItems.TIER_16M); - manaCells(consumer, AppBotItems.MANA_CELL_64M, AppBotItems.PORTABLE_MANA_CELL_64M, MEGAItems.TIER_64M); - manaCells(consumer, AppBotItems.MANA_CELL_256M, AppBotItems.PORTABLE_MANA_CELL_256M, MEGAItems.TIER_256M); + manaCells(writer, AppBotItems.MANA_CELL_1M, AppBotItems.PORTABLE_MANA_CELL_1M, MEGAItems.TIER_1M); + manaCells(writer, AppBotItems.MANA_CELL_4M, AppBotItems.PORTABLE_MANA_CELL_4M, MEGAItems.TIER_4M); + manaCells(writer, AppBotItems.MANA_CELL_16M, AppBotItems.PORTABLE_MANA_CELL_16M, MEGAItems.TIER_16M); + manaCells(writer, AppBotItems.MANA_CELL_64M, AppBotItems.PORTABLE_MANA_CELL_64M, MEGAItems.TIER_64M); + manaCells(writer, AppBotItems.MANA_CELL_256M, AppBotItems.PORTABLE_MANA_CELL_256M, MEGAItems.TIER_256M); + + new AppBotHousingRecipeProvider(output).buildRecipes(writer); } } private static void component( - Consumer consumer, + Consumer writer, StorageTier tier, StorageTier preceding, ItemLike binderItem, @@ -363,7 +362,7 @@ private static void component( .getPath(), has(precedingComponent)) .save( - consumer, + writer, MEGACells.makeId("cells/" + BuiltInRegistries.ITEM .getKey(tier.componentSupplier().get()) @@ -371,7 +370,7 @@ private static void component( } private static void cell( - Consumer consumer, + Consumer writer, ItemDefinition cell, ItemDefinition component, ItemDefinition housing, @@ -385,18 +384,18 @@ private static void cell( .define('c', component) .define('d', housingMaterial) .unlockedBy("has_" + component.id().getPath(), has(component)) - .save(consumer, MEGACells.makeId("cells/standard/" + cell.id().getPath())); + .save(writer, MEGACells.makeId("cells/standard/" + cell.id().getPath())); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, cell) .requires(housing) .requires(component) .unlockedBy("has_" + component.id().getPath(), has(component)) .unlockedBy("has_" + housing.id().getPath(), has(housing)) - .save(consumer, MEGACells.makeId("cells/standard/" + cell.id().getPath() + "_with_housing")); + .save(writer, MEGACells.makeId("cells/standard/" + cell.id().getPath() + "_with_housing")); } private static void portable( - Consumer consumer, + Consumer writer, ItemDefinition cell, ItemDefinition component, ItemDefinition housing) { @@ -408,11 +407,11 @@ private static void portable( .unlockedBy("has_" + housing.id().getPath(), has(housing)) .unlockedBy("has_" + component.id().getPath(), has(component)) .unlockedBy("has_dense_energy_cell", has(AEBlocks.DENSE_ENERGY_CELL)) - .save(consumer, MEGACells.makeId("cells/portable/" + cell.id().getPath())); + .save(writer, MEGACells.makeId("cells/portable/" + cell.id().getPath())); } private static void housing( - Consumer consumer, ItemDefinition housing, TagKey housingMaterial) { + Consumer writer, ItemDefinition housing, TagKey housingMaterial) { ShapedRecipeBuilder.shaped(RecipeCategory.MISC, housing) .pattern("aba") .pattern("b b") @@ -421,40 +420,44 @@ private static void housing( .define('b', AEItems.SKY_DUST) .define('d', housingMaterial) .unlockedBy("has_dusts/sky_stone", has(AEItems.SKY_DUST)) - .save(consumer, MEGACells.makeId("cells/" + housing.id().getPath())); + .save(writer, MEGACells.makeId("cells/" + housing.id().getPath())); } - private static void craftingBlock(Consumer consumer, BlockDefinition unit, ItemLike part) { + private static void craftingBlock(Consumer writer, BlockDefinition unit, ItemLike part) { ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, unit) .requires(MEGABlocks.MEGA_CRAFTING_UNIT) .requires(part) .unlockedBy("has_mega_crafting_unit", has(MEGABlocks.MEGA_CRAFTING_UNIT)) - .save(consumer, MEGACells.makeId("crafting/" + unit.id().getPath())); + .save(writer, MEGACells.makeId("crafting/" + unit.id().getPath())); } private static void manaCells( - Consumer consumer, ItemDefinition cell, ItemDefinition portable, StorageTier tier) { + Consumer writer, ItemDefinition cell, ItemDefinition portable, StorageTier tier) { var component = tier.componentSupplier().get(); var componentPath = BuiltInRegistries.ITEM.getKey(component).getPath(); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, cell) - .requires(AppBotItems.MEGA_MANA_CELL_HOUSING) - .requires(tier.componentSupplier().get()) - .unlockedBy("has_" + componentPath, has(component)) - .unlockedBy("has_mega_mana_cell_housing", has(AppBotItems.MEGA_MANA_CELL_HOUSING)) - .save(consumer, MEGACells.makeId("cells/standard/" + cell.id().getPath() + "_with_housing")); - - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, portable) - .requires(AEBlocks.CHEST) - .requires(component) - .requires(AEBlocks.DENSE_ENERGY_CELL) - .requires(AppBotItems.MEGA_MANA_CELL_HOUSING) - .unlockedBy("has_mega_mana_cell_housing", has(AppBotItems.MEGA_MANA_CELL_HOUSING)) - .unlockedBy("has_" + componentPath, has(component)) - .unlockedBy("has_dense_energy_cell", has(AEBlocks.DENSE_ENERGY_CELL)) - .save( - consumer, - MEGACells.makeId("cells/portable/" + portable.id().getPath())); + MEGACells.PLATFORM.addIntegrationRecipe( + writer, + ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, cell) + .requires(AppBotItems.MEGA_MANA_CELL_HOUSING) + .requires(tier.componentSupplier().get()) + .unlockedBy("has_" + componentPath, has(component)) + .unlockedBy("has_mega_mana_cell_housing", has(AppBotItems.MEGA_MANA_CELL_HOUSING)), + Addons.APPBOT, + MEGACells.makeId("cells/standard/" + cell.id().getPath() + "_with_housing")); + + MEGACells.PLATFORM.addIntegrationRecipe( + writer, + ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, portable) + .requires(AEBlocks.CHEST) + .requires(component) + .requires(AEBlocks.DENSE_ENERGY_CELL) + .requires(AppBotItems.MEGA_MANA_CELL_HOUSING) + .unlockedBy("has_mega_mana_cell_housing", has(AppBotItems.MEGA_MANA_CELL_HOUSING)) + .unlockedBy("has_" + componentPath, has(component)) + .unlockedBy("has_dense_energy_cell", has(AEBlocks.DENSE_ENERGY_CELL)), + Addons.APPBOT, + MEGACells.makeId("cells/portable/" + portable.id().getPath())); } @NotNull diff --git a/common/src/main/java/gripe/_90/megacells/core/Platform.java b/common/src/main/java/gripe/_90/megacells/core/Platform.java index 86c6e9ed..5a57b0de 100644 --- a/common/src/main/java/gripe/_90/megacells/core/Platform.java +++ b/common/src/main/java/gripe/_90/megacells/core/Platform.java @@ -2,10 +2,14 @@ import java.util.ArrayList; import java.util.List; +import java.util.function.Consumer; import net.minecraft.client.color.item.ItemColor; import net.minecraft.client.renderer.item.ItemProperties; import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.data.recipes.RecipeBuilder; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.Item; import net.minecraft.world.level.ItemLike; @@ -149,6 +153,12 @@ default void initUpgrades() { void addVillagerTrade(ItemLike item, int cost, int quantity, int xp); + void addIntegrationRecipe( + Consumer writer, FinishedRecipe recipe, Addons addon, ResourceLocation id); + + void addIntegrationRecipe( + Consumer writer, RecipeBuilder builder, Addons addon, ResourceLocation id); + interface Client { void initScreens(); diff --git a/common/src/main/resources/data/megacells/recipes/cells/mega_mana_cell_housing.json b/common/src/main/resources/data/megacells/recipes/cells/mega_mana_cell_housing.json deleted file mode 100644 index ee1fa607..00000000 --- a/common/src/main/resources/data/megacells/recipes/cells/mega_mana_cell_housing.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "type": "botania:terra_plate", - "ingredients": [ - { - "item": "appbot:mana_cell_housing" - }, - { - "item": "botania:mana_pearl" - }, - { - "item": "botania:mana_diamond" - }, - { - "item": "ae2:sky_dust" - }, - { - "item": "ae2:quartz_vibrant_glass" - } - ], - "mana": 2000000, - "result": { - "item": "megacells:mega_mana_cell_housing" - } -} diff --git a/fabric/build.gradle.kts b/fabric/build.gradle.kts index de55d694..71619866 100644 --- a/fabric/build.gradle.kts +++ b/fabric/build.gradle.kts @@ -23,15 +23,6 @@ repositories { } } - maven { - name = "BlameJared" - url = uri("https://maven.blamejared.com") - content { - includeGroup("vazkii.botania") - includeGroup("vazkii.patchouli") - } - } - maven { name = "TerraformersMC" url = uri("https://maven.terraformersmc.com/") diff --git a/fabric/src/data/java/gripe/_90/megacells/datagen/FabricRecipeProvider.java b/fabric/src/data/java/gripe/_90/megacells/datagen/FabricRecipeProvider.java new file mode 100644 index 00000000..cdbb72f1 --- /dev/null +++ b/fabric/src/data/java/gripe/_90/megacells/datagen/FabricRecipeProvider.java @@ -0,0 +1,17 @@ +package gripe._90.megacells.datagen; + +import java.util.function.Consumer; + +import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; +import net.minecraft.data.recipes.FinishedRecipe; + +public class FabricRecipeProvider extends net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider { + public FabricRecipeProvider(FabricDataOutput output) { + super(output); + } + + @Override + public void buildRecipes(Consumer exporter) { + new CommonRecipeProvider(output).buildRecipes(exporter); + } +} diff --git a/fabric/src/data/java/gripe/_90/megacells/datagen/MEGADataGenerators.java b/fabric/src/data/java/gripe/_90/megacells/datagen/MEGADataGenerators.java index b2e3a9e1..35520438 100644 --- a/fabric/src/data/java/gripe/_90/megacells/datagen/MEGADataGenerators.java +++ b/fabric/src/data/java/gripe/_90/megacells/datagen/MEGADataGenerators.java @@ -13,10 +13,10 @@ public void onInitializeDataGenerator(FabricDataGenerator generator) { pack.addProvider(CommonTagProvider.BlockTags::new); pack.addProvider(CommonTagProvider.ItemTags::new); + pack.addProvider(FabricRecipeProvider::new); pack.addProvider((FabricDataOutput output) -> new CommonLanguageProvider(output)); pack.addProvider((FabricDataOutput output) -> new CommonLootTableProvider(output)); - pack.addProvider((FabricDataOutput output) -> new CommonRecipeProvider(output)); pack.addProvider((FabricDataOutput output) -> new CommonModelProvider(output)); } diff --git a/fabric/src/main/java/gripe/_90/megacells/fabric/FabricPlatform.java b/fabric/src/main/java/gripe/_90/megacells/fabric/FabricPlatform.java index 2af5b489..542e388b 100644 --- a/fabric/src/main/java/gripe/_90/megacells/fabric/FabricPlatform.java +++ b/fabric/src/main/java/gripe/_90/megacells/fabric/FabricPlatform.java @@ -2,6 +2,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.function.Consumer; import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents; @@ -11,6 +12,9 @@ import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; import net.fabricmc.fabric.api.object.builder.v1.trade.TradeOfferHelper; import net.fabricmc.fabric.api.renderer.v1.model.ForwardingBakedModel; +import net.fabricmc.fabric.api.resource.conditions.v1.ConditionJsonProvider; +import net.fabricmc.fabric.api.resource.conditions.v1.DefaultResourceConditions; +import net.fabricmc.fabric.impl.datagen.FabricDataGenHelper; import net.fabricmc.loader.api.FabricLoader; import net.minecraft.client.Minecraft; import net.minecraft.client.color.item.ItemColor; @@ -20,6 +24,9 @@ import net.minecraft.core.Direction; import net.minecraft.core.Registry; import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.data.recipes.RecipeBuilder; +import net.minecraft.resources.ResourceLocation; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.npc.VillagerTrades; import net.minecraft.world.item.CreativeModeTab; @@ -112,6 +119,32 @@ public void addVillagerTrade(ItemLike item, int cost, int quantity, int xp) { builder -> builder.add(new VillagerTrades.ItemsForEmeralds(item.asItem(), cost, quantity, xp))); } + @SuppressWarnings("UnstableApiUsage") + @Override + public void addIntegrationRecipe( + Consumer writer, FinishedRecipe recipe, Addons addon, ResourceLocation id) { + Consumer withConditions = json -> { + FabricDataGenHelper.addConditions( + json, new ConditionJsonProvider[] {DefaultResourceConditions.allModsLoaded(addon.getModId())}); + writer.accept(json); + }; + + withConditions.accept(recipe); + } + + @SuppressWarnings("UnstableApiUsage") + @Override + public void addIntegrationRecipe( + Consumer writer, RecipeBuilder builder, Addons addon, ResourceLocation id) { + Consumer withConditions = json -> { + FabricDataGenHelper.addConditions( + json, new ConditionJsonProvider[] {DefaultResourceConditions.allModsLoaded(addon.getModId())}); + writer.accept(json); + }; + + builder.save(withConditions, id); + } + public static class Client implements Platform.Client { @Override public void initScreens() { diff --git a/forge/build.gradle.kts b/forge/build.gradle.kts index ef746752..591186c5 100644 --- a/forge/build.gradle.kts +++ b/forge/build.gradle.kts @@ -51,15 +51,6 @@ repositories { } } - maven { - name = "BlameJared" - url = uri("https://maven.blamejared.com") - content { - includeGroup("vazkii.botania") - includeGroup("vazkii.patchouli") - } - } - maven { name = "TheIllusiveC4" url = uri("https://maven.theillusivec4.top/") diff --git a/forge/src/data/java/gripe/_90/megacells/datagen/ForgeRecipeProvider.java b/forge/src/data/java/gripe/_90/megacells/datagen/ForgeRecipeProvider.java index b2d60a30..05ac3824 100644 --- a/forge/src/data/java/gripe/_90/megacells/datagen/ForgeRecipeProvider.java +++ b/forge/src/data/java/gripe/_90/megacells/datagen/ForgeRecipeProvider.java @@ -15,8 +15,6 @@ import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; -import net.minecraftforge.common.crafting.ConditionalRecipe; -import net.minecraftforge.common.crafting.conditions.ModLoadedCondition; import appeng.core.definitions.AEBlocks; import appeng.core.definitions.AEItems; @@ -133,9 +131,6 @@ private void chemPortable(Consumer consumer, ItemDefinition c } private void appmekRecipe(Consumer consumer, ResourceLocation id, RecipeBuilder builder) { - ConditionalRecipe.builder() - .addCondition(new ModLoadedCondition(Addons.APPMEK.getModId())) - .addRecipe(builder::save) - .build(consumer, id); + MEGACells.PLATFORM.addIntegrationRecipe(consumer, builder, Addons.APPMEK, id); } } diff --git a/forge/src/main/java/gripe/_90/megacells/forge/ForgePlatform.java b/forge/src/main/java/gripe/_90/megacells/forge/ForgePlatform.java index 3c13efe0..560d2daf 100644 --- a/forge/src/main/java/gripe/_90/megacells/forge/ForgePlatform.java +++ b/forge/src/main/java/gripe/_90/megacells/forge/ForgePlatform.java @@ -2,6 +2,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.function.Consumer; import org.apache.commons.lang3.ArrayUtils; import org.jetbrains.annotations.NotNull; @@ -19,6 +20,9 @@ import net.minecraft.core.Registry; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; +import net.minecraft.data.recipes.FinishedRecipe; +import net.minecraft.data.recipes.RecipeBuilder; +import net.minecraft.resources.ResourceLocation; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.npc.VillagerTrades; import net.minecraft.world.item.CreativeModeTab; @@ -33,6 +37,8 @@ import net.minecraftforge.client.event.RegisterColorHandlersEvent; import net.minecraftforge.client.model.data.ModelData; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.crafting.ConditionalRecipe; +import net.minecraftforge.common.crafting.conditions.ModLoadedCondition; import net.minecraftforge.event.OnDatapackSyncEvent; import net.minecraftforge.event.server.ServerStartedEvent; import net.minecraftforge.eventbus.api.IEventBus; @@ -205,6 +211,24 @@ public void addVillagerTrade(ItemLike item, int cost, int quantity, int xp) { offers.put(5, masterEntries); } + @Override + public void addIntegrationRecipe( + Consumer writer, FinishedRecipe recipe, Addons addon, ResourceLocation id) { + ConditionalRecipe.builder() + .addCondition(new ModLoadedCondition(addon.getModId())) + .addRecipe(recipe) + .build(writer, id); + } + + @Override + public void addIntegrationRecipe( + Consumer writer, RecipeBuilder builder, Addons addon, ResourceLocation id) { + ConditionalRecipe.builder() + .addCondition(new ModLoadedCondition(addon.getModId())) + .addRecipe(builder::save) + .build(writer, id); + } + public static class Client implements Platform.Client { @Override public void initScreens() {