Skip to content

Commit

Permalink
Add hotkey support to portable item and fluid cells
Browse files Browse the repository at this point in the history
  • Loading branch information
62832 committed Aug 30, 2023
1 parent 0204776 commit 3e87b5b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
7 changes: 7 additions & 0 deletions common/src/main/java/gripe/_90/megacells/MEGACells.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
import net.minecraft.resources.ResourceLocation;

import appeng.api.client.StorageCellModels;
import appeng.api.features.HotkeyAction;
import appeng.api.networking.GridServices;
import appeng.api.storage.StorageCells;
import appeng.api.upgrades.Upgrades;
import appeng.core.definitions.AEItems;
import appeng.core.localization.GuiText;
import appeng.hotkeys.HotkeyActions;

import gripe._90.megacells.core.Addons;
import gripe._90.megacells.core.Platform;
Expand Down Expand Up @@ -69,6 +71,11 @@ private static void initStorageCells() {
StorageCells.addCellHandler(MEGABulkCell.HANDLER);
StorageCellModels.registerModel(MEGAItems.BULK_ITEM_CELL, MEGACells.makeId("block/drive/cells/bulk_item_cell"));

MEGAItems.getItemPortables()
.forEach(cell -> HotkeyActions.registerPortableCell(cell, HotkeyAction.PORTABLE_ITEM_CELL));
MEGAItems.getFluidPortables()
.forEach(cell -> HotkeyActions.registerPortableCell(cell, HotkeyAction.PORTABLE_FLUID_CELL));

if (MEGACells.PLATFORM.isAddonLoaded(Addons.APPBOT)) {
Stream.of(AppBotItems.getCells(), AppBotItems.getPortables())
.flatMap(Collection::stream)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import appeng.items.parts.PartModelsHelper;
import appeng.items.storage.BasicStorageCell;
import appeng.items.storage.StorageTier;
import appeng.items.tools.powered.AbstractPortableCell;
import appeng.menu.me.common.MEStorageMenu;

import gripe._90.megacells.MEGACells;
Expand Down Expand Up @@ -126,7 +127,7 @@ public static List<ItemDefinition<?>> getFluidCells() {
return List.of(FLUID_CELL_1M, FLUID_CELL_4M, FLUID_CELL_16M, FLUID_CELL_64M, FLUID_CELL_256M);
}

public static List<ItemDefinition<?>> getItemPortables() {
public static List<ItemDefinition<? extends AbstractPortableCell>> getItemPortables() {
return List.of(
PORTABLE_ITEM_CELL_1M,
PORTABLE_ITEM_CELL_4M,
Expand All @@ -135,7 +136,7 @@ public static List<ItemDefinition<?>> getItemPortables() {
PORTABLE_ITEM_CELL_256M);
}

public static List<ItemDefinition<?>> getFluidPortables() {
public static List<ItemDefinition<? extends AbstractPortableCell>> getFluidPortables() {
return List.of(
PORTABLE_FLUID_CELL_1M,
PORTABLE_FLUID_CELL_4M,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import appeng.core.definitions.ItemDefinition;
import appeng.items.materials.MaterialItem;
import appeng.items.storage.StorageTier;
import appeng.items.tools.powered.AbstractPortableCell;

import appbot.item.ManaCellItem;
import appbot.item.PortableManaCellItem;
Expand Down Expand Up @@ -37,7 +38,7 @@ public static List<ItemDefinition<?>> getCells() {
return List.of(MANA_CELL_1M, MANA_CELL_4M, MANA_CELL_16M, MANA_CELL_64M, MANA_CELL_256M);
}

public static List<ItemDefinition<?>> getPortables() {
public static List<ItemDefinition<? extends AbstractPortableCell>> getPortables() {
return List.of(
PORTABLE_MANA_CELL_1M,
PORTABLE_MANA_CELL_4M,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import appeng.core.definitions.ItemDefinition;
import appeng.items.materials.MaterialItem;
import appeng.items.storage.StorageTier;
import appeng.items.tools.powered.AbstractPortableCell;

import me.ramidzkh.mekae2.item.ChemicalStorageCell;

Expand Down Expand Up @@ -48,7 +49,7 @@ public static List<ItemDefinition<?>> getCells() {
return List.of(CHEMICAL_CELL_1M, CHEMICAL_CELL_4M, CHEMICAL_CELL_16M, CHEMICAL_CELL_64M, CHEMICAL_CELL_256M);
}

public static List<ItemDefinition<?>> getPortables() {
public static List<ItemDefinition<? extends AbstractPortableCell>> getPortables() {
return List.of(
PORTABLE_CHEMICAL_CELL_1M,
PORTABLE_CHEMICAL_CELL_4M,
Expand Down

0 comments on commit 3e87b5b

Please sign in to comment.