Skip to content

Commit

Permalink
Stop trying to call getCells on nonexistent AppMek cells
Browse files Browse the repository at this point in the history
  • Loading branch information
62832 committed May 16, 2022
1 parent 36cf509 commit 0372072
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ninety.megacells.integration.appmek;

import java.util.Collections;
import java.util.List;

import net.minecraft.resources.ResourceLocation;
Expand Down Expand Up @@ -46,21 +47,23 @@ public MenuType<MEStorageMenu> portableCellMenu() {

@Override
public List<Item> getCells() {
return List.of(
return AppMekIntegration.isAppMekLoaded() ? List.of(
MEGAItems.CHEMICAL_CELL_1M.asItem(),
MEGAItems.CHEMICAL_CELL_4M.asItem(),
MEGAItems.CHEMICAL_CELL_16M.asItem(),
MEGAItems.CHEMICAL_CELL_64M.asItem(),
MEGAItems.CHEMICAL_CELL_256M.asItem());
MEGAItems.CHEMICAL_CELL_256M.asItem())
: Collections.emptyList();
}

@Override
public List<Item> getPortableCells() {
return List.of(
return AppMekIntegration.isAppMekLoaded() ? List.of(
MEGAItems.PORTABLE_CHEMICAL_CELL_1M.asItem(),
MEGAItems.PORTABLE_CHEMICAL_CELL_4M.asItem(),
MEGAItems.PORTABLE_CHEMICAL_CELL_16M.asItem(),
MEGAItems.PORTABLE_CHEMICAL_CELL_64M.asItem(),
MEGAItems.PORTABLE_CHEMICAL_CELL_256M.asItem());
MEGAItems.PORTABLE_CHEMICAL_CELL_256M.asItem())
: Collections.emptyList();
}
}
6 changes: 3 additions & 3 deletions src/main/java/ninety/megacells/item/MEGAItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ private static ItemDefinition<MEGAPortableCell> portable(MEGACellTier tier, IMEG

private static <T extends Item> ItemDefinition<T> item(String id, Function<Item.Properties, T> factory,
boolean register) {
Item.Properties p = new Item.Properties().tab(CREATIVE_TAB);
T item = factory.apply(p);

if (register) {
Item.Properties p = new Item.Properties().tab(CREATIVE_TAB);
T item = factory.apply(p);

ItemDefinition<T> definition = new ItemDefinition<>(MEGACells.makeId(id), item);
ITEMS.add(definition);

Expand Down

0 comments on commit 0372072

Please sign in to comment.