Skip to content

Commit

Permalink
Re-include integration, temporarily clamp max supported add-on versions
Browse files Browse the repository at this point in the history
  • Loading branch information
62832 committed Jul 20, 2023
1 parent 31380f9 commit 7023df4
Show file tree
Hide file tree
Showing 12 changed files with 102 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import appeng.api.storage.StorageCells;

import gripe._90.megacells.definition.MEGAItems;
import gripe._90.megacells.integration.appbot.AppBotItems;
import gripe._90.megacells.item.MEGABulkCell;
import gripe._90.megacells.util.Utils;

Expand All @@ -20,10 +21,11 @@ public static void init() {
StorageCells.addCellHandler(MEGABulkCell.HANDLER);
StorageCellModels.registerModel(MEGAItems.BULK_ITEM_CELL, Utils.makeId("block/drive/cells/bulk_item_cell"));

/*
* if (Utils.PLATFORM.isModLoaded("appbot")) { Stream.of(AppBotItems.getCells(),
* AppBotItems.getPortables()).flatMap(Collection::stream) .forEach(c -> StorageCellModels.registerModel(c,
* Utils.makeId("block/drive/cells/mega_mana_cell"))); }
*/
if (Utils.PLATFORM.isModLoaded("appbot")) {
Stream.of(AppBotItems.getCells(),
AppBotItems.getPortables()).flatMap(Collection::stream)
.forEach(c -> StorageCellModels.registerModel(c,
Utils.makeId("block/drive/cells/mega_mana_cell")));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import gripe._90.megacells.definition.MEGAItems;
import gripe._90.megacells.integration.ae2wt.AE2WTIntegration;
import gripe._90.megacells.integration.appbot.AppBotIntegration;
import gripe._90.megacells.util.Utils;

public class InitUpgrades {
Expand Down Expand Up @@ -63,8 +64,8 @@ public static void init() {
AE2WTIntegration.initUpgrades();
}

/*
* if (Utils.PLATFORM.isModLoaded("appbot")) { AppBotIntegration.initUpgrades(); }
*/
if (Utils.PLATFORM.isModLoaded("appbot")) {
AppBotIntegration.initUpgrades();
}
}
}
4 changes: 2 additions & 2 deletions fabric/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ dependencies {
modImplementation("curse.maven:ae2wtlib-459929:${property("ae2wtFile")}")

modCompileOnly("curse.maven:applied-botanics-addon-610632:${property("appbotFile")}") {
exclude(group = "dev.emi", module = "emi")
exclude(group = "dev.emi", module = "emi-fabric")
}

modRuntimeOnly("vazkii.botania:Botania:$minecraftVersion-${property("botaniaVersion")}-FABRIC-SNAPSHOT") {
exclude(group = "dev.emi", module = "emi")
exclude(group = "dev.emi", module = "emi-fabric")
}

modRuntimeOnly("me.shedaniel.cloth:cloth-config-fabric:${property("clothVersion")}")
Expand Down
32 changes: 15 additions & 17 deletions fabric/src/data/java/gripe/_90/megacells/datagen/ModelProvider.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package gripe._90.megacells.datagen;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Supplier;
import java.util.stream.Stream;

import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
Expand Down Expand Up @@ -40,6 +38,7 @@
import gripe._90.megacells.block.MEGAPatternProviderBlock;
import gripe._90.megacells.definition.MEGABlocks;
import gripe._90.megacells.definition.MEGAItems;
import gripe._90.megacells.integration.appbot.AppBotItems;
import gripe._90.megacells.util.Utils;

class ModelProvider extends FabricModelProvider {
Expand Down Expand Up @@ -93,7 +92,6 @@ public void generateItemModels(ItemModelGenerators generator) {

generator.generateFlatItem(MEGAItems.MEGA_ITEM_CELL_HOUSING.asItem(), ModelTemplates.FLAT_ITEM);
generator.generateFlatItem(MEGAItems.MEGA_FLUID_CELL_HOUSING.asItem(), ModelTemplates.FLAT_ITEM);
// generator.generateFlatItem(AppBotItems.MEGA_MANA_CELL_HOUSING.asItem(), ModelTemplates.FLAT_ITEM);

generator.generateFlatItem(MEGAItems.CELL_COMPONENT_1M.asItem(), ModelTemplates.FLAT_ITEM);
generator.generateFlatItem(MEGAItems.CELL_COMPONENT_4M.asItem(), ModelTemplates.FLAT_ITEM);
Expand All @@ -108,12 +106,20 @@ public void generateItemModels(ItemModelGenerators generator) {
generator.generateFlatItem(MEGAItems.DECOMPRESSION_PATTERN.asItem(), AEItems.CRAFTING_PATTERN.asItem(),
ModelTemplates.FLAT_ITEM);

var cells = Stream.concat(
Stream.of(MEGAItems.getItemCells(), MEGAItems.getFluidCells()
// , AppBotItems.getCells()
)
.flatMap(Collection::stream),
Stream.of(MEGAItems.BULK_ITEM_CELL)).toList();
var cells = new ArrayList<>(MEGAItems.getItemCells());
cells.addAll(MEGAItems.getFluidCells());
cells.add(MEGAItems.BULK_ITEM_CELL);

var portables = new ArrayList<>(MEGAItems.getItemPortables());
portables.addAll(MEGAItems.getFluidPortables());

if (Utils.PLATFORM.isModLoaded("appbot")) {
cells.addAll(AppBotItems.getCells());
portables.addAll(AppBotItems.getPortables());

generator.generateFlatItem(AppBotItems.MEGA_MANA_CELL_HOUSING.asItem(), ModelTemplates.FLAT_ITEM);
createDriveCellModel("mega_mana_cell", generator.output);
}

for (var cell : cells) {
createCellItem(
Expand All @@ -122,13 +128,6 @@ public void generateItemModels(ItemModelGenerators generator) {
AppEng.makeId("item/storage_cell_led"), generator.output);
}

var portables = Stream.concat(
Stream.of(MEGAItems.getItemPortables(), MEGAItems.getFluidPortables()
// , AppBotItems.getPortables()
)
.flatMap(Collection::stream),
Stream.of()).toList();

for (var cell : portables) {
createCellItem(
Utils.makeId("item/cell/portable/" + cell.id().getPath()),
Expand All @@ -138,7 +137,6 @@ public void generateItemModels(ItemModelGenerators generator) {

createDriveCellModel("mega_item_cell", generator.output);
createDriveCellModel("mega_fluid_cell", generator.output);
createDriveCellModel("mega_mana_cell", generator.output);
createDriveCellModel("bulk_item_cell", generator.output);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import gripe._90.megacells.definition.MEGABlocks;
import gripe._90.megacells.definition.MEGAItems;
import gripe._90.megacells.definition.MEGAParts;
import gripe._90.megacells.integration.appbot.AppBotItems;
import gripe._90.megacells.util.Utils;

class RecipeProvider extends FabricRecipeProvider {
Expand Down Expand Up @@ -172,16 +173,16 @@ public void buildRecipes(@NotNull Consumer<FinishedRecipe> consumer) {
.unlockedBy("has_cable_mega_pattern_provider", has(MEGAParts.MEGA_PATTERN_PROVIDER))
.save(consumer, Utils.makeId("network/mega_pattern_provider_block"));

/*
* 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);
*/
if (Utils.PLATFORM.isModLoaded("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);
}
}

private static void component(Consumer<FinishedRecipe> consumer, StorageTier tier, StorageTier preceding,
private void component(Consumer<FinishedRecipe> consumer, StorageTier tier, StorageTier preceding,
ItemLike binder) {
var precedingComponent = preceding.componentSupplier().get();
ShapedRecipeBuilder.shaped(RecipeCategory.MISC, tier.componentSupplier().get())
Expand All @@ -199,15 +200,15 @@ private static void component(Consumer<FinishedRecipe> consumer, StorageTier tie
"cells/" + BuiltInRegistries.ITEM.getKey(tier.componentSupplier().get()).getPath()));
}

private static void specialisedComponent(Consumer<FinishedRecipe> consumer, ItemLike top, ItemLike bottom,
private void specialisedComponent(Consumer<FinishedRecipe> consumer, ItemLike top, ItemLike bottom,
ItemDefinition<?> output) {
InscriberRecipeBuilder.inscribe(AEItems.SINGULARITY, output, 1)
.setMode(InscriberProcessType.PRESS)
.setTop(Ingredient.of(top)).setBottom(Ingredient.of(bottom))
.save(consumer, Utils.makeId("inscriber/" + output.id().getPath()));
}

private static void cell(Consumer<FinishedRecipe> consumer, ItemDefinition<?> cell, ItemDefinition<?> component,
private void cell(Consumer<FinishedRecipe> consumer, ItemDefinition<?> cell, ItemDefinition<?> component,
ItemDefinition<?> housing, String housingMaterial) {
ShapedRecipeBuilder.shaped(RecipeCategory.MISC, cell)
.pattern("aba")
Expand All @@ -228,7 +229,7 @@ private static void cell(Consumer<FinishedRecipe> consumer, ItemDefinition<?> ce
.save(consumer, Utils.makeId("cells/standard/" + cell.id().getPath() + "_with_housing"));
}

private static void portable(Consumer<FinishedRecipe> consumer, ItemDefinition<?> cell, ItemDefinition<?> component,
private void portable(Consumer<FinishedRecipe> consumer, ItemDefinition<?> cell, ItemDefinition<?> component,
ItemDefinition<?> housing) {
ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, cell)
.requires(AEBlocks.CHEST)
Expand All @@ -241,7 +242,7 @@ private static void portable(Consumer<FinishedRecipe> consumer, ItemDefinition<?
.save(consumer, Utils.makeId("cells/portable/" + cell.id().getPath()));
}

private static void housing(Consumer<FinishedRecipe> consumer, ItemDefinition<?> housing, String housingMaterial) {
private void housing(Consumer<FinishedRecipe> consumer, ItemDefinition<?> housing, String housingMaterial) {
ShapedRecipeBuilder.shaped(RecipeCategory.MISC, housing)
.pattern("aba")
.pattern("b b")
Expand All @@ -253,34 +254,33 @@ private static void housing(Consumer<FinishedRecipe> consumer, ItemDefinition<?>
.save(consumer, Utils.makeId("cells/" + housing.id().getPath()));
}

private static void craftingBlock(Consumer<FinishedRecipe> consumer, BlockDefinition<?> unit, ItemLike part) {
private void craftingBlock(Consumer<FinishedRecipe> consumer, 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, Utils.makeId("crafting/" + unit.id().getPath()));
}

// private static void manaCells(Consumer<FinishedRecipe> consumer, 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, Utils.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, Utils.makeId("cells/portable/" + portable.id().getPath()));
// }

private static Ingredient placeholderTag(String placeholder) {
private void manaCells(Consumer<FinishedRecipe> consumer, 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, Utils.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, Utils.makeId("cells/portable/" + portable.id().getPath()));
}

private Ingredient placeholderTag(String placeholder) {
return Ingredient.fromValues(Stream.of(new PlaceholderTagValue(placeholder)));
}

Expand Down
8 changes: 5 additions & 3 deletions fabric/src/main/java/gripe/_90/megacells/MEGACells.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
import gripe._90.megacells.definition.MEGAParts;
import gripe._90.megacells.init.InitStorageCells;
import gripe._90.megacells.init.InitUpgrades;
import gripe._90.megacells.integration.appbot.AppBotItems;
import gripe._90.megacells.service.CompressionService;
import gripe._90.megacells.service.DecompressionService;
import gripe._90.megacells.util.Utils;

public class MEGACells implements IAEAddonEntrypoint {
@Override
Expand All @@ -39,9 +41,9 @@ private void initAll() {
MEGAParts.init();
MEGABlockEntities.init();

/*
* if (Utils.PLATFORM.isModLoaded("appbot")) { AppBotItems.init(); }
*/
if (Utils.PLATFORM.isModLoaded("appbot")) {
AppBotItems.init();
}
}

private void registerAll() {
Expand Down
9 changes: 5 additions & 4 deletions fabric/src/main/java/gripe/_90/megacells/MEGACellsClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import gripe._90.megacells.definition.MEGABlockEntities;
import gripe._90.megacells.definition.MEGABlocks;
import gripe._90.megacells.definition.MEGAItems;
import gripe._90.megacells.integration.appbot.AppBotItems;
import gripe._90.megacells.util.Utils;

@Environment(EnvType.CLIENT)
Expand Down Expand Up @@ -82,10 +83,10 @@ private void initItemColors() {
var portables = new ArrayList<>(MEGAItems.getItemPortables());
portables.addAll(MEGAItems.getFluidPortables());

/*
* if (Utils.PLATFORM.isModLoaded("appbot")) { cells.addAll(AppBotItems.getCells());
* portables.addAll(AppBotItems.getPortables()); }
*/
if (Utils.PLATFORM.isModLoaded("appbot")) {
cells.addAll(AppBotItems.getCells());
portables.addAll(AppBotItems.getPortables());
}

ColorProviderRegistry.ITEM.register(BasicStorageCell::getColor, cells.toArray(new ItemLike[0]));
ColorProviderRegistry.ITEM.register(PortableCellItem::getColor, portables.toArray(new ItemLike[0]));
Expand Down
2 changes: 1 addition & 1 deletion fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
},
"suggests": {
"ae2wtlib": ">=$ae2wtVersion",
"appbot": ">=$appbotVersion"
"appbot": "$appbotVersion"
}
}
1 change: 1 addition & 0 deletions forge/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ae2wtFile=4649864
architecturyVersion=9.1.10
curiosVersion=5.2.0-beta.3

appmekVersion=1.3.4
appmekFile=4058235
mekanismVersion=10.3.5.474

Expand Down
27 changes: 16 additions & 11 deletions forge/src/main/java/gripe/_90/megacells/forge/MEGACells.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
import gripe._90.megacells.definition.MEGAParts;
import gripe._90.megacells.init.InitStorageCells;
import gripe._90.megacells.init.InitUpgrades;
import gripe._90.megacells.integration.appbot.AppBotItems;
import gripe._90.megacells.integration.appmek.AppMekIntegration;
import gripe._90.megacells.integration.appmek.AppMekItems;
import gripe._90.megacells.service.CompressionService;
import gripe._90.megacells.service.DecompressionService;
import gripe._90.megacells.util.Utils;
Expand All @@ -52,13 +55,13 @@ private void initAll() {
MEGAParts.init();
MEGABlockEntities.init();

/*
* if (Utils.PLATFORM.isModLoaded("appmek")) { AppMekItems.init(); }
*/
if (Utils.PLATFORM.isModLoaded("appmek")) {
AppMekItems.init();
}

/*
* if (Utils.PLATFORM.isModLoaded("appbot")) { AppBotItems.init(); }
*/
if (Utils.PLATFORM.isModLoaded("appbot")) {
AppBotItems.init();
}
}

private void registerAll(RegisterEvent event) {
Expand Down Expand Up @@ -89,7 +92,7 @@ private void registerAll(RegisterEvent event) {

private void populateTab(BuildCreativeModeTabContentsEvent event) {
if (event.getTabKey() == MEGAItems.CREATIVE_TAB_KEY) {
MEGAItems.getItems().forEach(event::accept);
MEGAItems.getItems().stream().filter(i -> i != MEGAItems.DECOMPRESSION_PATTERN).forEach(event::accept);
MEGABlocks.getBlocks().forEach(event::accept);
}
}
Expand All @@ -98,10 +101,12 @@ private void initCells(FMLCommonSetupEvent event) {
event.enqueueWork(InitStorageCells::init);
event.enqueueWork(InitUpgrades::init);

/*
* event.enqueueWork(() -> { if (Utils.PLATFORM.isModLoaded("appmek")) { AppMekIntegration.initUpgrades();
* AppMekIntegration.initStorageCells(); } });
*/
event.enqueueWork(() -> {
if (Utils.PLATFORM.isModLoaded("appmek")) {
AppMekIntegration.initUpgrades();
AppMekIntegration.initStorageCells();
}
});
}

private void initCompression() {
Expand Down
Loading

0 comments on commit 7023df4

Please sign in to comment.