diff --git a/common/src/main/java/gripe/_90/megacells/definition/MEGAParts.java b/common/src/main/java/gripe/_90/megacells/definition/MEGAParts.java index 8c0bf2ea..7aef06ce 100644 --- a/common/src/main/java/gripe/_90/megacells/definition/MEGAParts.java +++ b/common/src/main/java/gripe/_90/megacells/definition/MEGAParts.java @@ -15,7 +15,6 @@ import gripe._90.megacells.part.MEGAPatternProviderPart; public final class MEGAParts { - public static void init() { // controls static load order } diff --git a/common/src/main/java/gripe/_90/megacells/init/InitStorageCells.java b/common/src/main/java/gripe/_90/megacells/init/InitStorageCells.java index 991b0c85..739178dc 100644 --- a/common/src/main/java/gripe/_90/megacells/init/InitStorageCells.java +++ b/common/src/main/java/gripe/_90/megacells/init/InitStorageCells.java @@ -9,6 +9,7 @@ import gripe._90.megacells.definition.MEGAItems; import gripe._90.megacells.integration.appbot.AppBotItems; import gripe._90.megacells.item.MEGABulkCell; +import gripe._90.megacells.util.Addons; import gripe._90.megacells.util.Utils; public class InitStorageCells { @@ -21,7 +22,7 @@ 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")) { + if (Utils.PLATFORM.isAddonLoaded(Addons.APPBOT)) { Stream.of(AppBotItems.getCells(), AppBotItems.getPortables()).flatMap(Collection::stream) .forEach(c -> StorageCellModels.registerModel(c, diff --git a/common/src/main/java/gripe/_90/megacells/init/InitUpgrades.java b/common/src/main/java/gripe/_90/megacells/init/InitUpgrades.java index bc646704..349d61cf 100644 --- a/common/src/main/java/gripe/_90/megacells/init/InitUpgrades.java +++ b/common/src/main/java/gripe/_90/megacells/init/InitUpgrades.java @@ -9,6 +9,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.Addons; import gripe._90.megacells.util.Utils; public class InitUpgrades { @@ -60,11 +61,11 @@ public static void init() { Upgrades.add(MEGAItems.GREATER_ENERGY_CARD, portableCell, 2, portableCellGroup); } - if (Utils.PLATFORM.isModLoaded("ae2wtlib")) { + if (Utils.PLATFORM.isAddonLoaded(Addons.AE2WTLIB)) { AE2WTIntegration.initUpgrades(); } - if (Utils.PLATFORM.isModLoaded("appbot")) { + if (Utils.PLATFORM.isAddonLoaded(Addons.APPBOT)) { AppBotIntegration.initUpgrades(); } } diff --git a/common/src/main/java/gripe/_90/megacells/item/MEGABulkCell.java b/common/src/main/java/gripe/_90/megacells/item/MEGABulkCell.java index cece0d3d..9a04cbd9 100644 --- a/common/src/main/java/gripe/_90/megacells/item/MEGABulkCell.java +++ b/common/src/main/java/gripe/_90/megacells/item/MEGABulkCell.java @@ -126,7 +126,7 @@ public FuzzyMode getFuzzyMode(ItemStack itemStack) { public void setFuzzyMode(ItemStack itemStack, FuzzyMode fuzzyMode) { } - private static class Handler implements ICellHandler { + public static class Handler implements ICellHandler { private Handler() { } diff --git a/common/src/main/java/gripe/_90/megacells/item/cell/BulkCellInventory.java b/common/src/main/java/gripe/_90/megacells/item/cell/BulkCellInventory.java index aa784c76..6bb9f97e 100644 --- a/common/src/main/java/gripe/_90/megacells/item/cell/BulkCellInventory.java +++ b/common/src/main/java/gripe/_90/megacells/item/cell/BulkCellInventory.java @@ -65,7 +65,7 @@ public BulkCellInventory(MEGABulkCell cell, ItemStack o, ISaveProvider container this.unitFactor = decompressed.values().intStream().asLongStream().reduce(1, Math::multiplyExact); this.storedItem = getTag().contains(KEY) ? AEItemKey.fromTag(getTag().getCompound(KEY)) : null; - this.unitCount = !getTag().getString(UNIT_COUNT).equals("") + this.unitCount = !getTag().getString(UNIT_COUNT).isEmpty() ? new BigInteger(getTag().getString(UNIT_COUNT)) : BigInteger.ZERO; this.highestCompressed = storedItem; diff --git a/common/src/main/java/gripe/_90/megacells/util/Addons.java b/common/src/main/java/gripe/_90/megacells/util/Addons.java new file mode 100644 index 00000000..92f598e1 --- /dev/null +++ b/common/src/main/java/gripe/_90/megacells/util/Addons.java @@ -0,0 +1,17 @@ +package gripe._90.megacells.util; + +public enum Addons { + APPMEK("appmek"), + APPBOT("appbot"), + AE2WTLIB("ae2wtlib"); + + private final String modId; + + Addons(String modId) { + this.modId = modId; + } + + public String getModId() { + return modId; + } +} diff --git a/common/src/main/java/gripe/_90/megacells/util/service/Platform.java b/common/src/main/java/gripe/_90/megacells/util/service/Platform.java index efe0defe..af8fefdd 100644 --- a/common/src/main/java/gripe/_90/megacells/util/service/Platform.java +++ b/common/src/main/java/gripe/_90/megacells/util/service/Platform.java @@ -2,12 +2,14 @@ import net.minecraft.world.item.CreativeModeTab; +import gripe._90.megacells.util.Addons; + public interface Platform { Loader getLoader(); CreativeModeTab getCreativeTab(CreativeModeTab.DisplayItemsGenerator display); - boolean isModLoaded(String modId); + boolean isAddonLoaded(Addons modId); enum Loader { FABRIC, FORGE diff --git a/fabric/src/data/java/gripe/_90/megacells/datagen/ModelProvider.java b/fabric/src/data/java/gripe/_90/megacells/datagen/ModelProvider.java index b9d9ee9a..7cca8684 100644 --- a/fabric/src/data/java/gripe/_90/megacells/datagen/ModelProvider.java +++ b/fabric/src/data/java/gripe/_90/megacells/datagen/ModelProvider.java @@ -41,6 +41,7 @@ import gripe._90.megacells.definition.MEGABlocks; import gripe._90.megacells.definition.MEGAItems; import gripe._90.megacells.integration.appbot.AppBotItems; +import gripe._90.megacells.util.Addons; import gripe._90.megacells.util.Utils; class ModelProvider extends FabricModelProvider { @@ -125,15 +126,13 @@ public void generateItemModels(ItemModelGenerators generator) { cells.addAll(MEGAItems.getFluidCells()); cells.add(MEGAItems.BULK_ITEM_CELL); - if (Utils.PLATFORM.isModLoaded("appbot")) { + if (Utils.PLATFORM.isAddonLoaded(Addons.APPBOT)) { cells.addAll(AppBotItems.getCells()); generator.generateFlatItem(AppBotItems.MEGA_MANA_CELL_HOUSING.asItem(), ModelTemplates.FLAT_ITEM); - for (var portable : AppBotItems.getPortables()) { - // lot of assumptions being made here in advance - portableModel(portable, "mana", new ResourceLocation("appbot", "item/portable_cell_mana_housing"), - generator); - } + // lot of assumptions being made here in advance + AppBotItems.getPortables().forEach(p -> portableModel(p, "mana", + new ResourceLocation(Addons.APPBOT.getModId(), "item/portable_cell_mana_housing"), generator)); driveCell("mega_mana_cell", generator); } diff --git a/fabric/src/data/java/gripe/_90/megacells/datagen/RecipeProvider.java b/fabric/src/data/java/gripe/_90/megacells/datagen/RecipeProvider.java index 2b3d0a85..8cf6ce49 100644 --- a/fabric/src/data/java/gripe/_90/megacells/datagen/RecipeProvider.java +++ b/fabric/src/data/java/gripe/_90/megacells/datagen/RecipeProvider.java @@ -36,6 +36,7 @@ import gripe._90.megacells.definition.MEGAParts; import gripe._90.megacells.definition.MEGATags; import gripe._90.megacells.integration.appbot.AppBotItems; +import gripe._90.megacells.util.Addons; import gripe._90.megacells.util.Utils; class RecipeProvider extends FabricRecipeProvider { @@ -216,7 +217,7 @@ public void buildRecipes(@NotNull Consumer consumer) { .unlockedBy("has_cable_mega_pattern_provider", has(MEGAParts.MEGA_PATTERN_PROVIDER)) .save(consumer, Utils.makeId("network/mega_pattern_provider_block")); - if (Utils.PLATFORM.isModLoaded("appbot")) { + if (Utils.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); diff --git a/fabric/src/main/java/gripe/_90/megacells/MEGACells.java b/fabric/src/main/java/gripe/_90/megacells/MEGACells.java index 8b6f4a55..da962654 100644 --- a/fabric/src/main/java/gripe/_90/megacells/MEGACells.java +++ b/fabric/src/main/java/gripe/_90/megacells/MEGACells.java @@ -21,6 +21,7 @@ import gripe._90.megacells.integration.appbot.AppBotItems; import gripe._90.megacells.service.CompressionService; import gripe._90.megacells.service.DecompressionService; +import gripe._90.megacells.util.Addons; import gripe._90.megacells.util.Utils; public class MEGACells implements IAEAddonEntrypoint { @@ -41,7 +42,7 @@ private void initAll() { MEGAParts.init(); MEGABlockEntities.init(); - if (Utils.PLATFORM.isModLoaded("appbot")) { + if (Utils.PLATFORM.isAddonLoaded(Addons.APPBOT)) { AppBotItems.init(); } } diff --git a/fabric/src/main/java/gripe/_90/megacells/MEGACellsClient.java b/fabric/src/main/java/gripe/_90/megacells/MEGACellsClient.java index fcd0d84d..e0781d42 100644 --- a/fabric/src/main/java/gripe/_90/megacells/MEGACellsClient.java +++ b/fabric/src/main/java/gripe/_90/megacells/MEGACellsClient.java @@ -31,6 +31,7 @@ import gripe._90.megacells.definition.MEGABlocks; import gripe._90.megacells.definition.MEGAItems; import gripe._90.megacells.integration.appbot.AppBotItems; +import gripe._90.megacells.util.Addons; import gripe._90.megacells.util.Utils; @Environment(EnvType.CLIENT) @@ -83,7 +84,7 @@ private void initItemColors() { var portables = new ArrayList<>(MEGAItems.getItemPortables()); portables.addAll(MEGAItems.getFluidPortables()); - if (Utils.PLATFORM.isModLoaded("appbot")) { + if (Utils.PLATFORM.isAddonLoaded(Addons.APPBOT)) { cells.addAll(AppBotItems.getCells()); portables.addAll(AppBotItems.getPortables()); } diff --git a/fabric/src/main/java/gripe/_90/megacells/util/FabricPlatform.java b/fabric/src/main/java/gripe/_90/megacells/util/FabricPlatform.java index 7f29b18e..a763afea 100644 --- a/fabric/src/main/java/gripe/_90/megacells/util/FabricPlatform.java +++ b/fabric/src/main/java/gripe/_90/megacells/util/FabricPlatform.java @@ -24,7 +24,7 @@ public CreativeModeTab getCreativeTab(CreativeModeTab.DisplayItemsGenerator disp } @Override - public boolean isModLoaded(String modId) { - return FabricLoaderImpl.INSTANCE.isModLoaded(modId); + public boolean isAddonLoaded(Addons addon) { + return FabricLoaderImpl.INSTANCE.isModLoaded(addon.getModId()); } } diff --git a/forge/src/main/java/gripe/_90/megacells/datagen/ModelProvider.java b/forge/src/main/java/gripe/_90/megacells/datagen/ModelProvider.java index f8dab3ce..53ba7fb4 100644 --- a/forge/src/main/java/gripe/_90/megacells/datagen/ModelProvider.java +++ b/forge/src/main/java/gripe/_90/megacells/datagen/ModelProvider.java @@ -33,6 +33,9 @@ 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.integration.appmek.AppMekItems; +import gripe._90.megacells.util.Addons; import gripe._90.megacells.util.Utils; abstract class ModelProvider { @@ -47,6 +50,7 @@ static class Items extends ItemModelProvider { private static final ResourceLocation PORTABLE_CELL_FLUID_HOUSING = AppEng.makeId("item/portable_cell_fluid_housing"); private static final ResourceLocation CABLE_INTERFACE = AppEng.makeId("item/cable_interface"); + private static final ResourceLocation DRIVE_CELL = AppEng.makeId("block/drive/drive_cell"); //spotless:on public Items(PackOutput output, ExistingFileHelper existing) { @@ -57,6 +61,7 @@ public Items(PackOutput output, ExistingFileHelper existing) { existing.trackGenerated(PORTABLE_CELL_ITEM_HOUSING, TEXTURE); existing.trackGenerated(PORTABLE_CELL_FLUID_HOUSING, TEXTURE); existing.trackGenerated(CABLE_INTERFACE, MODEL); + existing.trackGenerated(DRIVE_CELL, MODEL); } @Override @@ -86,10 +91,38 @@ protected void registerModels() { MEGAItems.getItemPortables().forEach(p -> portableModel(p, "item", PORTABLE_CELL_ITEM_HOUSING)); MEGAItems.getFluidPortables().forEach(p -> portableModel(p, "fluid", PORTABLE_CELL_FLUID_HOUSING)); + driveCell("mega_item_cell"); + driveCell("mega_fluid_cell"); + driveCell("bulk_item_cell"); + var cells = new ArrayList<>(MEGAItems.getItemCells()); cells.addAll(MEGAItems.getFluidCells()); cells.add(MEGAItems.BULK_ITEM_CELL); + if (Utils.PLATFORM.isAddonLoaded(Addons.APPMEK)) { + basicItem(AppMekItems.MEGA_CHEMICAL_CELL_HOUSING.asItem()); + + cells.addAll(AppMekItems.getCells()); + // TODO + AppMekItems.getPortables().forEach(p -> portableModel(p, "chemical", PORTABLE_CELL_ITEM_HOUSING)); + + basicItem(AppMekItems.RADIOACTIVE_CELL_COMPONENT.asItem()); + cells.add(AppMekItems.RADIOACTIVE_CHEMICAL_CELL); + + driveCell("mega_chemical_cell"); + driveCell("radioactive_chemical_cell"); + } + + if (Utils.PLATFORM.isAddonLoaded(Addons.APPBOT)) { + basicItem(AppBotItems.MEGA_MANA_CELL_HOUSING.asItem()); + + cells.addAll(AppBotItems.getCells()); + // TODO + AppBotItems.getPortables().forEach(p -> portableModel(p, "mana", PORTABLE_CELL_ITEM_HOUSING)); + + driveCell("mega_mana_cell"); + } + cells.forEach(this::cellModel); patternProviderPart(); @@ -110,6 +143,11 @@ private void portableModel(ItemDefinition portable, String screenType, Resour .texture("layer3", "item/cell/portable/portable_cell_side_%s".formatted(tierSuffix)); } + private void driveCell(String texture) { + var path = "block/drive/cells/" + texture; + withExistingParent(path, DRIVE_CELL).texture("cell", path); + } + private void patternProviderPart() { withExistingParent(MEGAParts.MEGA_PATTERN_PROVIDER.id().getPath(), CABLE_INTERFACE) .texture("back", "part/mega_monitor_back") @@ -147,15 +185,6 @@ protected void registerStatesAndModels() { Pair.of(MEGABlocks.CRAFTING_ACCELERATOR, "accelerator")); craftingUnits.forEach(block -> craftingModel(block.first, block.second)); craftingMonitor(); - - driveCell("mega_item_cell"); - driveCell("mega_fluid_cell"); - driveCell("bulk_item_cell"); - } - - private void driveCell(String texture) { - var path = "block/drive/cells/" + texture; - models().withExistingParent(path, DRIVE_CELL).texture("cell", path); } private void energyCell() { diff --git a/forge/src/main/java/gripe/_90/megacells/datagen/RecipeProvider.java b/forge/src/main/java/gripe/_90/megacells/datagen/RecipeProvider.java index 3b560558..ed11831e 100644 --- a/forge/src/main/java/gripe/_90/megacells/datagen/RecipeProvider.java +++ b/forge/src/main/java/gripe/_90/megacells/datagen/RecipeProvider.java @@ -10,7 +10,9 @@ import net.minecraft.data.recipes.RecipeCategory; import net.minecraft.data.recipes.ShapedRecipeBuilder; import net.minecraft.data.recipes.ShapelessRecipeBuilder; +import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.FluidTags; +import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; @@ -31,11 +33,17 @@ import appeng.recipes.transform.TransformCircumstance; import appeng.recipes.transform.TransformRecipeBuilder; +import mekanism.common.registries.MekanismBlocks; +import mekanism.common.registries.MekanismItems; +import mekanism.generators.common.registries.GeneratorsBlocks; + import gripe._90.megacells.definition.MEGABlocks; import gripe._90.megacells.definition.MEGAItems; import gripe._90.megacells.definition.MEGAParts; import gripe._90.megacells.definition.MEGATags; import gripe._90.megacells.integration.appbot.AppBotItems; +import gripe._90.megacells.integration.appmek.AppMekItems; +import gripe._90.megacells.util.Addons; import gripe._90.megacells.util.Utils; public class RecipeProvider extends net.minecraft.data.recipes.RecipeProvider { @@ -216,7 +224,46 @@ protected void buildRecipes(@NotNull Consumer consumer) { .unlockedBy("has_cable_mega_pattern_provider", has(MEGAParts.MEGA_PATTERN_PROVIDER)) .save(consumer, Utils.makeId("network/mega_pattern_provider_block")); - if (Utils.PLATFORM.isModLoaded("appbot")) { + if (Utils.PLATFORM.isAddonLoaded(Addons.APPMEK)) { + var osmiumTag = ItemTags.create(new ResourceLocation("forge", "ingots/osmium")); + + // spotless:off + housing(consumer, AppMekItems.MEGA_CHEMICAL_CELL_HOUSING, osmiumTag); + + cell(consumer, AppMekItems.CHEMICAL_CELL_1M, MEGAItems.CELL_COMPONENT_1M, AppMekItems.MEGA_CHEMICAL_CELL_HOUSING, osmiumTag); + cell(consumer, AppMekItems.CHEMICAL_CELL_4M, MEGAItems.CELL_COMPONENT_4M, AppMekItems.MEGA_CHEMICAL_CELL_HOUSING, osmiumTag); + cell(consumer, AppMekItems.CHEMICAL_CELL_16M, MEGAItems.CELL_COMPONENT_16M, AppMekItems.MEGA_CHEMICAL_CELL_HOUSING, osmiumTag); + cell(consumer, AppMekItems.CHEMICAL_CELL_64M, MEGAItems.CELL_COMPONENT_64M, AppMekItems.MEGA_CHEMICAL_CELL_HOUSING, osmiumTag); + cell(consumer, AppMekItems.CHEMICAL_CELL_256M, MEGAItems.CELL_COMPONENT_256M, AppMekItems.MEGA_CHEMICAL_CELL_HOUSING, osmiumTag); + + portable(consumer, AppMekItems.PORTABLE_CHEMICAL_CELL_1M, MEGAItems.CELL_COMPONENT_1M, AppMekItems.MEGA_CHEMICAL_CELL_HOUSING); + portable(consumer, AppMekItems.PORTABLE_CHEMICAL_CELL_4M, MEGAItems.CELL_COMPONENT_4M, AppMekItems.MEGA_CHEMICAL_CELL_HOUSING); + portable(consumer, AppMekItems.PORTABLE_CHEMICAL_CELL_16M, MEGAItems.CELL_COMPONENT_16M, AppMekItems.MEGA_CHEMICAL_CELL_HOUSING); + portable(consumer, AppMekItems.PORTABLE_CHEMICAL_CELL_64M, MEGAItems.CELL_COMPONENT_64M, AppMekItems.MEGA_CHEMICAL_CELL_HOUSING); + portable(consumer, AppMekItems.PORTABLE_CHEMICAL_CELL_256M, MEGAItems.CELL_COMPONENT_256M, AppMekItems.MEGA_CHEMICAL_CELL_HOUSING); + //spotless:on + + // TODO + InscriberRecipeBuilder.inscribe(AEItems.SINGULARITY, AppMekItems.RADIOACTIVE_CELL_COMPONENT, 1) + .setMode(InscriberProcessType.PRESS) + .setTop(Ingredient.of(AEItems.CELL_COMPONENT_256K)) + .setBottom(Ingredient.of(MekanismBlocks.RADIOACTIVE_WASTE_BARREL)) + .save(consumer, Utils.makeId("inscriber/radioactive_cell_component")); + + ShapedRecipeBuilder.shaped(RecipeCategory.MISC, AppMekItems.RADIOACTIVE_CHEMICAL_CELL) + .pattern("aba") + .pattern("bcb") + .pattern("ded") + .define('a', GeneratorsBlocks.REACTOR_GLASS) + .define('b', AEItems.SKY_DUST) + .define('c', AppMekItems.RADIOACTIVE_CELL_COMPONENT) + .define('d', MekanismItems.HDPE_SHEET) + .define('e', MekanismItems.POLONIUM_PELLET) + .unlockedBy("has_radioactive_cell_component", has(AppMekItems.RADIOACTIVE_CELL_COMPONENT)) + .save(consumer, Utils.makeId("cells/standard/radioactive_chemical_cell")); + } + + if (Utils.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); diff --git a/forge/src/main/java/gripe/_90/megacells/forge/MEGACells.java b/forge/src/main/java/gripe/_90/megacells/forge/MEGACells.java index bd6c4b3f..67bcc5b1 100644 --- a/forge/src/main/java/gripe/_90/megacells/forge/MEGACells.java +++ b/forge/src/main/java/gripe/_90/megacells/forge/MEGACells.java @@ -32,6 +32,7 @@ import gripe._90.megacells.integration.appmek.AppMekItems; import gripe._90.megacells.service.CompressionService; import gripe._90.megacells.service.DecompressionService; +import gripe._90.megacells.util.Addons; import gripe._90.megacells.util.Utils; @Mod(Utils.MODID) @@ -54,11 +55,11 @@ private void initAll() { MEGAParts.init(); MEGABlockEntities.init(); - if (Utils.PLATFORM.isModLoaded("appmek")) { + if (Utils.PLATFORM.isAddonLoaded(Addons.APPMEK)) { AppMekItems.init(); } - if (Utils.PLATFORM.isModLoaded("appbot")) { + if (Utils.PLATFORM.isAddonLoaded(Addons.APPBOT)) { AppBotItems.init(); } } @@ -94,7 +95,7 @@ private void initCells(FMLCommonSetupEvent event) { event.enqueueWork(InitUpgrades::init); event.enqueueWork(() -> { - if (Utils.PLATFORM.isModLoaded("appmek")) { + if (Utils.PLATFORM.isAddonLoaded(Addons.APPMEK)) { AppMekIntegration.initUpgrades(); AppMekIntegration.initStorageCells(); } diff --git a/forge/src/main/java/gripe/_90/megacells/forge/MEGACellsClient.java b/forge/src/main/java/gripe/_90/megacells/forge/MEGACellsClient.java index eab859d1..fb2836a5 100644 --- a/forge/src/main/java/gripe/_90/megacells/forge/MEGACellsClient.java +++ b/forge/src/main/java/gripe/_90/megacells/forge/MEGACellsClient.java @@ -30,6 +30,7 @@ import gripe._90.megacells.definition.MEGAItems; import gripe._90.megacells.integration.appbot.AppBotItems; import gripe._90.megacells.integration.appmek.AppMekItems; +import gripe._90.megacells.util.Addons; import gripe._90.megacells.util.Utils; public class MEGACellsClient { @@ -83,13 +84,13 @@ private void initItemColors(RegisterColorHandlersEvent.Item event) { var portables = new ArrayList<>(MEGAItems.getItemPortables()); portables.addAll(MEGAItems.getFluidPortables()); - if (Utils.PLATFORM.isModLoaded("appmek")) { + if (Utils.PLATFORM.isAddonLoaded(Addons.APPMEK)) { cells.addAll(AppMekItems.getCells()); portables.addAll(AppMekItems.getPortables()); cells.add(AppMekItems.RADIOACTIVE_CHEMICAL_CELL); } - if (Utils.PLATFORM.isModLoaded("appbot")) { + if (Utils.PLATFORM.isAddonLoaded(Addons.APPBOT)) { cells.addAll(AppBotItems.getCells()); portables.addAll(AppBotItems.getPortables()); } diff --git a/forge/src/main/java/gripe/_90/megacells/integration/appmek/AppMekIntegration.java b/forge/src/main/java/gripe/_90/megacells/integration/appmek/AppMekIntegration.java index fdb33a71..dcf9004d 100644 --- a/forge/src/main/java/gripe/_90/megacells/integration/appmek/AppMekIntegration.java +++ b/forge/src/main/java/gripe/_90/megacells/integration/appmek/AppMekIntegration.java @@ -13,7 +13,7 @@ import me.ramidzkh.mekae2.AMItems; import gripe._90.megacells.definition.MEGAItems; -import gripe._90.megacells.integration.appmek.item.cell.RadioactiveCellHandler; +import gripe._90.megacells.integration.appmek.item.MEGARadioactiveCell; import gripe._90.megacells.util.Utils; public final class AppMekIntegration { @@ -45,7 +45,7 @@ public static void initStorageCells() { Stream.of(AppMekItems.getCells(), AppMekItems.getPortables()).flatMap(Collection::stream) .forEach(c -> StorageCellModels.registerModel(c, Utils.makeId("block/drive/cells/mega_chemical_cell"))); - StorageCells.addCellHandler(RadioactiveCellHandler.INSTANCE); + StorageCells.addCellHandler(MEGARadioactiveCell.HANDLER); StorageCellModels.registerModel(AppMekItems.RADIOACTIVE_CHEMICAL_CELL.asItem(), Utils.makeId("block/drive/cells/radioactive_chemical_cell")); } diff --git a/forge/src/main/java/gripe/_90/megacells/integration/appmek/AppMekItems.java b/forge/src/main/java/gripe/_90/megacells/integration/appmek/AppMekItems.java index 990eb666..27a5e6f7 100644 --- a/forge/src/main/java/gripe/_90/megacells/integration/appmek/AppMekItems.java +++ b/forge/src/main/java/gripe/_90/megacells/integration/appmek/AppMekItems.java @@ -22,22 +22,19 @@ public static void init() { public static final ItemDefinition MEGA_CHEMICAL_CELL_HOUSING = MEGAItems .item("MEGA Chemical Cell Housing", "mega_chemical_cell_housing", MaterialItem::new); + // spotless:off public static final ItemDefinition CHEMICAL_CELL_1M = cell(MEGAItems.TIER_1M); public static final ItemDefinition CHEMICAL_CELL_4M = cell(MEGAItems.TIER_4M); public static final ItemDefinition CHEMICAL_CELL_16M = cell(MEGAItems.TIER_16M); public static final ItemDefinition CHEMICAL_CELL_64M = cell(MEGAItems.TIER_64M); public static final ItemDefinition CHEMICAL_CELL_256M = cell(MEGAItems.TIER_256M); - public static final ItemDefinition PORTABLE_CHEMICAL_CELL_1M = portable( - MEGAItems.TIER_1M); - public static final ItemDefinition PORTABLE_CHEMICAL_CELL_4M = portable( - MEGAItems.TIER_4M); - public static final ItemDefinition PORTABLE_CHEMICAL_CELL_16M = portable( - MEGAItems.TIER_16M); - public static final ItemDefinition PORTABLE_CHEMICAL_CELL_64M = portable( - MEGAItems.TIER_64M); - public static final ItemDefinition PORTABLE_CHEMICAL_CELL_256M = portable( - MEGAItems.TIER_256M); + public static final ItemDefinition PORTABLE_CHEMICAL_CELL_1M = portable(MEGAItems.TIER_1M); + public static final ItemDefinition PORTABLE_CHEMICAL_CELL_4M = portable(MEGAItems.TIER_4M); + public static final ItemDefinition PORTABLE_CHEMICAL_CELL_16M = portable(MEGAItems.TIER_16M); + public static final ItemDefinition PORTABLE_CHEMICAL_CELL_64M = portable(MEGAItems.TIER_64M); + public static final ItemDefinition PORTABLE_CHEMICAL_CELL_256M = portable(MEGAItems.TIER_256M); + //spotless:on public static final ItemDefinition RADIOACTIVE_CELL_COMPONENT = MEGAItems .item("MEGA Radioactive Storage Component", "radioactive_cell_component", MaterialItem::new); diff --git a/forge/src/main/java/gripe/_90/megacells/integration/appmek/datagen/AppMekDataGenerators.java b/forge/src/main/java/gripe/_90/megacells/integration/appmek/datagen/AppMekDataGenerators.java deleted file mode 100644 index 0ff78b33..00000000 --- a/forge/src/main/java/gripe/_90/megacells/integration/appmek/datagen/AppMekDataGenerators.java +++ /dev/null @@ -1,16 +0,0 @@ -package gripe._90.megacells.integration.appmek.datagen; - -import net.minecraftforge.data.event.GatherDataEvent; - -import gripe._90.megacells.util.Utils; - -public class AppMekDataGenerators { - public static void onGatherData(GatherDataEvent event) { - if (Utils.PLATFORM.isModLoaded("appmek")) { - var pack = event.getGenerator().getVanillaPack(true); - - pack.addProvider(packOutput -> new AppMekItemModelProvider(packOutput, event.getExistingFileHelper())); - pack.addProvider(AppMekRecipeProvider::new); - } - } -} diff --git a/forge/src/main/java/gripe/_90/megacells/integration/appmek/datagen/AppMekItemModelProvider.java b/forge/src/main/java/gripe/_90/megacells/integration/appmek/datagen/AppMekItemModelProvider.java deleted file mode 100644 index b0091de8..00000000 --- a/forge/src/main/java/gripe/_90/megacells/integration/appmek/datagen/AppMekItemModelProvider.java +++ /dev/null @@ -1,75 +0,0 @@ -package gripe._90.megacells.integration.appmek.datagen; - -import org.jetbrains.annotations.NotNull; - -import net.minecraft.data.PackOutput; -import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.client.model.generators.ItemModelBuilder; -import net.minecraftforge.client.model.generators.ItemModelProvider; -import net.minecraftforge.common.data.ExistingFileHelper; - -import appeng.core.AppEng; -import appeng.core.definitions.ItemDefinition; - -import gripe._90.megacells.integration.appmek.AppMekItems; -import gripe._90.megacells.util.Utils; - -public class AppMekItemModelProvider extends ItemModelProvider { - static final ResourceLocation STORAGE_CELL_LED = AppEng.makeId("item/storage_cell_led"); - static final ResourceLocation PORTABLE_CELL_LED = AppEng.makeId("item/portable_cell_led"); - static final ResourceLocation DRIVE_CELL = AppEng.makeId("block/drive/drive_cell"); - - public AppMekItemModelProvider(PackOutput output, ExistingFileHelper efh) { - super(output, Utils.MODID, efh); - efh.trackGenerated(STORAGE_CELL_LED, TEXTURE); - efh.trackGenerated(PORTABLE_CELL_LED, TEXTURE); - efh.trackGenerated(DRIVE_CELL, MODEL); - } - - @Override - protected void registerModels() { - flatSingleLayer(AppMekItems.MEGA_CHEMICAL_CELL_HOUSING); - - for (var storage : AppMekItems.getCells()) { - cell(storage); - } - - for (var portable : AppMekItems.getPortables()) { - portable(portable); - } - - flatSingleLayer(AppMekItems.RADIOACTIVE_CELL_COMPONENT); - cell(AppMekItems.RADIOACTIVE_CHEMICAL_CELL); - - driveCell("mega_chemical_cell"); - driveCell("radioactive_chemical_cell"); - } - - private void driveCell(String texture) { - withExistingParent("block/drive/cells/" + texture, DRIVE_CELL).texture("cell", - Utils.makeId("block/drive/cells/" + texture)); - } - - private void cell(ItemDefinition cell) { - flatSingleLayer(cell, "cell/standard/").texture("layer1", STORAGE_CELL_LED); - } - - private void portable(ItemDefinition cell) { - flatSingleLayer(cell, "cell/portable/").texture("layer1", PORTABLE_CELL_LED); - } - - private void flatSingleLayer(ItemDefinition item) { - flatSingleLayer(item, ""); - } - - private ItemModelBuilder flatSingleLayer(ItemDefinition item, String subfolder) { - String path = item.id().getPath(); - return singleTexture(path, mcLoc("item/generated"), "layer0", Utils.makeId("item/" + subfolder + path)); - } - - @NotNull - @Override - public String getName() { - return super.getName() + "/appmek"; - } -} diff --git a/forge/src/main/java/gripe/_90/megacells/integration/appmek/datagen/AppMekRecipeProvider.java b/forge/src/main/java/gripe/_90/megacells/integration/appmek/datagen/AppMekRecipeProvider.java deleted file mode 100644 index e36dd07f..00000000 --- a/forge/src/main/java/gripe/_90/megacells/integration/appmek/datagen/AppMekRecipeProvider.java +++ /dev/null @@ -1,114 +0,0 @@ -package gripe._90.megacells.integration.appmek.datagen; - -import java.util.function.Consumer; - -import org.jetbrains.annotations.NotNull; - -import net.minecraft.data.PackOutput; -import net.minecraft.data.recipes.FinishedRecipe; -import net.minecraft.data.recipes.RecipeCategory; -import net.minecraft.data.recipes.RecipeProvider; -import net.minecraft.data.recipes.ShapedRecipeBuilder; -import net.minecraft.data.recipes.ShapelessRecipeBuilder; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.tags.ItemTags; -import net.minecraft.world.item.crafting.Ingredient; - -import appeng.core.definitions.AEBlocks; -import appeng.core.definitions.AEItems; -import appeng.core.definitions.ItemDefinition; -import appeng.recipes.handlers.InscriberProcessType; -import appeng.recipes.handlers.InscriberRecipeBuilder; - -import mekanism.common.registries.MekanismBlocks; -import mekanism.common.registries.MekanismItems; -import mekanism.generators.common.registries.GeneratorsBlocks; - -import gripe._90.megacells.definition.MEGAItems; -import gripe._90.megacells.integration.appmek.AppMekItems; -import gripe._90.megacells.util.Utils; - -public class AppMekRecipeProvider extends RecipeProvider { - public AppMekRecipeProvider(PackOutput output) { - super(output); - } - - @Override - protected void buildRecipes(@NotNull Consumer consumer) { - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, AppMekItems.MEGA_CHEMICAL_CELL_HOUSING) - .pattern("aba") - .pattern("b b") - .pattern("ddd") - .define('a', AEBlocks.QUARTZ_VIBRANT_GLASS) - .define('b', AEItems.SKY_DUST) - .define('d', ItemTags.create(new ResourceLocation("forge", "ingots/osmium"))) - .unlockedBy("has_dusts/sky_stone", has(AEItems.SKY_DUST)) - .save(consumer, Utils.makeId("cells/mega_chemical_cell_housing")); - - cell(consumer, AppMekItems.CHEMICAL_CELL_1M, MEGAItems.CELL_COMPONENT_1M); - cell(consumer, AppMekItems.CHEMICAL_CELL_4M, MEGAItems.CELL_COMPONENT_4M); - cell(consumer, AppMekItems.CHEMICAL_CELL_16M, MEGAItems.CELL_COMPONENT_16M); - cell(consumer, AppMekItems.CHEMICAL_CELL_64M, MEGAItems.CELL_COMPONENT_64M); - cell(consumer, AppMekItems.CHEMICAL_CELL_256M, MEGAItems.CELL_COMPONENT_256M); - - portable(consumer, AppMekItems.PORTABLE_CHEMICAL_CELL_1M, MEGAItems.CELL_COMPONENT_1M); - portable(consumer, AppMekItems.PORTABLE_CHEMICAL_CELL_4M, MEGAItems.CELL_COMPONENT_4M); - portable(consumer, AppMekItems.PORTABLE_CHEMICAL_CELL_16M, MEGAItems.CELL_COMPONENT_16M); - portable(consumer, AppMekItems.PORTABLE_CHEMICAL_CELL_64M, MEGAItems.CELL_COMPONENT_64M); - portable(consumer, AppMekItems.PORTABLE_CHEMICAL_CELL_256M, MEGAItems.CELL_COMPONENT_256M); - - InscriberRecipeBuilder.inscribe(AEItems.SINGULARITY, AppMekItems.RADIOACTIVE_CELL_COMPONENT, 1) - .setMode(InscriberProcessType.PRESS) - .setTop(Ingredient.of(AEItems.CELL_COMPONENT_256K)) - .setBottom(Ingredient.of(MekanismBlocks.RADIOACTIVE_WASTE_BARREL)) - .save(consumer, Utils.makeId("inscriber/radioactive_cell_component")); - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, AppMekItems.RADIOACTIVE_CHEMICAL_CELL) - .pattern("aba") - .pattern("bcb") - .pattern("ded") - .define('a', GeneratorsBlocks.REACTOR_GLASS) - .define('b', AEItems.SKY_DUST) - .define('c', AppMekItems.RADIOACTIVE_CELL_COMPONENT) - .define('d', MekanismItems.HDPE_SHEET) - .define('e', MekanismItems.POLONIUM_PELLET) - .unlockedBy("has_radioactive_cell_component", has(AppMekItems.RADIOACTIVE_CELL_COMPONENT)) - .save(consumer, Utils.makeId("cells/standard/radioactive_chemical_cell")); - } - - private void cell(Consumer consumer, ItemDefinition cell, ItemDefinition component) { - ShapedRecipeBuilder.shaped(RecipeCategory.MISC, cell) - .pattern("aba") - .pattern("bcb") - .pattern("ddd") - .define('a', AEBlocks.QUARTZ_VIBRANT_GLASS) - .define('b', AEItems.SKY_DUST) - .define('c', component) - .define('d', ItemTags.create(new ResourceLocation("forge", "ingots/osmium"))) - .unlockedBy("has_" + component.id().getPath(), has(component)) - .save(consumer, Utils.makeId("cells/standard/" + cell.id().getPath())); - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, cell) - .requires(AppMekItems.MEGA_CHEMICAL_CELL_HOUSING) - .requires(component) - .unlockedBy("has_" + component.id().getPath(), has(component)) - .unlockedBy("has_mega_chemical_cell_housing", has(AppMekItems.MEGA_CHEMICAL_CELL_HOUSING)) - .save(consumer, Utils.makeId("cells/standard/" + cell.id().getPath() + "_with_housing")); - } - - private void portable(Consumer consumer, ItemDefinition cell, ItemDefinition component) { - ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, cell) - .requires(AEBlocks.CHEST) - .requires(component) - .requires(AEBlocks.DENSE_ENERGY_CELL) - .requires(AppMekItems.MEGA_CHEMICAL_CELL_HOUSING) - .unlockedBy("has_" + component.id().getPath(), has(component)) - .unlockedBy("has_mega_chemical_cell_housing", has(AppMekItems.MEGA_CHEMICAL_CELL_HOUSING)) - .unlockedBy("has_dense_energy_cell", has(AEBlocks.DENSE_ENERGY_CELL)) - .save(consumer, Utils.makeId("cells/portable/" + cell.id().getPath())); - } - - /* - * why the fuck is this final now - * - * @Override public @NotNull String getName() { return super.getName() + "/appmek"; } - */ -} diff --git a/forge/src/main/java/gripe/_90/megacells/integration/appmek/item/MEGARadioactiveCell.java b/forge/src/main/java/gripe/_90/megacells/integration/appmek/item/MEGARadioactiveCell.java index d1dac4f3..333562b3 100644 --- a/forge/src/main/java/gripe/_90/megacells/integration/appmek/item/MEGARadioactiveCell.java +++ b/forge/src/main/java/gripe/_90/megacells/integration/appmek/item/MEGARadioactiveCell.java @@ -2,26 +2,32 @@ import java.util.List; -import com.google.common.base.Preconditions; - import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.level.Level; import appeng.api.config.FuzzyMode; +import appeng.api.storage.cells.ICellHandler; import appeng.api.storage.cells.ICellWorkbenchItem; +import appeng.api.storage.cells.ISaveProvider; +import appeng.core.localization.Tooltips; import appeng.items.AEBaseItem; import appeng.items.contents.CellConfig; import appeng.util.ConfigInventory; import me.ramidzkh.mekae2.ae2.MekanismKeyType; -import gripe._90.megacells.integration.appmek.item.cell.RadioactiveCellHandler; +import gripe._90.megacells.definition.MEGATranslations; +import gripe._90.megacells.integration.appmek.item.cell.RadioactiveCellInventory; public class MEGARadioactiveCell extends AEBaseItem implements ICellWorkbenchItem { + public static final Handler HANDLER = new Handler(); + public MEGARadioactiveCell(Properties properties) { super(properties.stacksTo(1)); } @@ -40,10 +46,48 @@ public void setFuzzyMode(ItemStack itemStack, FuzzyMode fuzzyMode) { } @Override - public void appendHoverText(ItemStack is, Level level, @NotNull List lines, - @NotNull TooltipFlag advancedTooltips) { - Preconditions.checkArgument(is.getItem() == this); - RadioactiveCellHandler.INSTANCE.addCellInformationToTooltip(is, lines); + public void appendHoverText(@NotNull ItemStack is, Level level, @NotNull List lines, + @NotNull TooltipFlag adv) { + var inv = HANDLER.getCellInventory(is, null); + + if (inv != null) { + var containedType = inv.getAvailableStacks().getFirstKey(); + var filterItem = inv.getFilterItem(); + + lines.add(Tooltips.bytesUsed(inv.getUsedBytes(), RadioactiveCellInventory.MAX_BYTES)); + lines.add(Tooltips.of(containedType != null ? MEGATranslations.Contains.text(containedType.getDisplayName()) + : MEGATranslations.Empty.text())); + + if (filterItem != null) { + if (containedType == null) { + lines.add(Tooltips.of(MEGATranslations.PartitionedFor.text(filterItem.getDisplayName()))); + } else { + if (!containedType.equals(filterItem)) { + lines.add(MEGATranslations.MismatchedFilter.text().withStyle(ChatFormatting.DARK_RED)); + } + } + if (inv.isBlackListed(filterItem)) { + lines.add(MEGATranslations.FilterChemicalUnsupported.text().withStyle(ChatFormatting.DARK_RED)); + } + } else { + lines.add(Tooltips.of(MEGATranslations.NotPartitioned.text())); + } + } } + public static class Handler implements ICellHandler { + private Handler() { + } + + @Override + public boolean isCell(ItemStack is) { + return is != null && is.getItem() instanceof MEGARadioactiveCell; + } + + @Nullable + @Override + public RadioactiveCellInventory getCellInventory(ItemStack is, @Nullable ISaveProvider container) { + return RadioactiveCellInventory.createInventory(is, container); + } + } } diff --git a/forge/src/main/java/gripe/_90/megacells/integration/appmek/item/cell/RadioactiveCellHandler.java b/forge/src/main/java/gripe/_90/megacells/integration/appmek/item/cell/RadioactiveCellHandler.java deleted file mode 100644 index 7aef783b..00000000 --- a/forge/src/main/java/gripe/_90/megacells/integration/appmek/item/cell/RadioactiveCellHandler.java +++ /dev/null @@ -1,63 +0,0 @@ -package gripe._90.megacells.integration.appmek.item.cell; - -import java.util.List; - -import org.jetbrains.annotations.Nullable; - -import net.minecraft.ChatFormatting; -import net.minecraft.network.chat.Component; -import net.minecraft.world.item.ItemStack; - -import appeng.api.storage.cells.ICellHandler; -import appeng.api.storage.cells.ISaveProvider; -import appeng.core.localization.Tooltips; - -import gripe._90.megacells.definition.MEGATranslations; -import gripe._90.megacells.integration.appmek.item.MEGARadioactiveCell; - -public class RadioactiveCellHandler implements ICellHandler { - public static final RadioactiveCellHandler INSTANCE = new RadioactiveCellHandler(); - - private RadioactiveCellHandler() { - } - - @Override - public boolean isCell(ItemStack is) { - return is != null && is.getItem() instanceof MEGARadioactiveCell; - } - - @Nullable - @Override - public RadioactiveCellInventory getCellInventory(ItemStack is, @Nullable ISaveProvider container) { - return RadioactiveCellInventory.createInventory(is, container); - } - - public void addCellInformationToTooltip(ItemStack is, List lines) { - var handler = getCellInventory(is, null); - if (handler == null) { - return; - } - - var containedType = handler.getAvailableStacks().getFirstKey(); - var filterItem = handler.getFilterItem(); - - lines.add(Tooltips.bytesUsed(handler.getUsedBytes(), RadioactiveCellInventory.MAX_BYTES)); - lines.add(Tooltips.of(containedType != null ? MEGATranslations.Contains.text(containedType.getDisplayName()) - : MEGATranslations.Empty.text())); - - if (filterItem != null) { - if (containedType == null) { - lines.add(Tooltips.of(MEGATranslations.PartitionedFor.text(filterItem.getDisplayName()))); - } else { - if (!containedType.equals(filterItem)) { - lines.add(MEGATranslations.MismatchedFilter.text().withStyle(ChatFormatting.DARK_RED)); - } - } - if (handler.isBlackListed(filterItem)) { - lines.add(MEGATranslations.FilterChemicalUnsupported.text().withStyle(ChatFormatting.DARK_RED)); - } - } else { - lines.add(Tooltips.of(MEGATranslations.NotPartitioned.text())); - } - } -} diff --git a/forge/src/main/java/gripe/_90/megacells/integration/appmek/item/cell/RadioactiveCellInventory.java b/forge/src/main/java/gripe/_90/megacells/integration/appmek/item/cell/RadioactiveCellInventory.java index 5ce16536..1f6c00c4 100644 --- a/forge/src/main/java/gripe/_90/megacells/integration/appmek/item/cell/RadioactiveCellInventory.java +++ b/forge/src/main/java/gripe/_90/megacells/integration/appmek/item/cell/RadioactiveCellInventory.java @@ -29,7 +29,7 @@ public class RadioactiveCellInventory implements StorageCell { private static final String KEY = "key"; private static final String COUNT = "count"; - static final int MAX_BYTES = 256; + public static final int MAX_BYTES = 256; private static final long MAX_MB = (long) MAX_BYTES * MekanismKeyType.TYPE.getAmountPerByte(); private final ISaveProvider container; @@ -93,7 +93,7 @@ public CellState getStatus() { return CellState.NOT_EMPTY; } - protected AEKey getFilterItem() { + public AEKey getFilterItem() { var config = getConfigInventory().keySet().stream().toList(); if (config.isEmpty()) { return null; @@ -102,7 +102,7 @@ protected AEKey getFilterItem() { } } - protected long getUsedBytes() { + public long getUsedBytes() { return this.chemAmount / MekanismKeyType.TYPE.getAmountPerByte(); } @@ -115,7 +115,7 @@ private ConfigInventory getConfigInventory() { return this.cellType.getConfigInventory(this.i); } - protected boolean isBlackListed(AEKey what) { + public boolean isBlackListed(AEKey what) { if (what instanceof MekanismKey key) { return ChemicalAttributeValidator.DEFAULT.process(key.getStack()) || key.getStack().getRaw().getChemical() == MekanismGases.SPENT_NUCLEAR_WASTE.getChemical(); diff --git a/forge/src/main/java/gripe/_90/megacells/util/forge/ForgePlatform.java b/forge/src/main/java/gripe/_90/megacells/util/forge/ForgePlatform.java index 8d221414..72c9dd05 100644 --- a/forge/src/main/java/gripe/_90/megacells/util/forge/ForgePlatform.java +++ b/forge/src/main/java/gripe/_90/megacells/util/forge/ForgePlatform.java @@ -7,6 +7,7 @@ import gripe._90.megacells.definition.MEGAItems; import gripe._90.megacells.definition.MEGATranslations; +import gripe._90.megacells.util.Addons; import gripe._90.megacells.util.service.Platform; public final class ForgePlatform implements Platform { @@ -25,11 +26,11 @@ public CreativeModeTab getCreativeTab(CreativeModeTab.DisplayItemsGenerator disp } @Override - public boolean isModLoaded(String modId) { + public boolean isAddonLoaded(Addons addon) { if (ModList.get() == null) { - return LoadingModList.get().getMods().stream().map(ModInfo::getModId).anyMatch(modId::equals); + return LoadingModList.get().getMods().stream().map(ModInfo::getModId).anyMatch(addon.getModId()::equals); } - return ModList.get().isLoaded(modId); + return ModList.get().isLoaded(addon.getModId()); } }