Skip to content

Commit

Permalink
Removed concept of "ICellGuiHandler". ME chests will now always open …
Browse files Browse the repository at this point in the history
…a terminal view for all cell types. (AppliedEnergistics#7996)

Fixes AppliedEnergistics#7995
  • Loading branch information
shartte authored Jun 30, 2024
1 parent 1038776 commit 7756c19
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 193 deletions.
33 changes: 0 additions & 33 deletions src/main/java/appeng/api/storage/StorageCells.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import net.minecraft.world.item.ItemStack;

import appeng.api.storage.cells.IBasicCellItem;
import appeng.api.storage.cells.ICellGuiHandler;
import appeng.api.storage.cells.ICellHandler;
import appeng.api.storage.cells.ISaveProvider;
import appeng.api.storage.cells.StorageCell;
Expand All @@ -46,7 +45,6 @@
public final class StorageCells {

private static final List<ICellHandler> handlers = new ArrayList<>();
private static final List<ICellGuiHandler> guiHandlers = new ArrayList<>();

private StorageCells() {
}
Expand All @@ -67,15 +65,6 @@ public static synchronized void addCellHandler(ICellHandler handler) {
handlers.add(handler);
}

/**
* Register a new handler
*
* @param handler cell gui handler
*/
public static synchronized void addCellGuiHandler(ICellGuiHandler handler) {
guiHandlers.add(handler);
}

/**
* return true, if you can get a InventoryHandler for the item passed.
*
Expand Down Expand Up @@ -114,28 +103,6 @@ public static synchronized ICellHandler getHandler(ItemStack is) {
return null;
}

/**
* get the handler, for the requested channel.
*
* @param is ItemStack
* @return the handler registered for this channel.
*/
@Nullable
public static synchronized ICellGuiHandler getGuiHandler(ItemStack is) {
ICellGuiHandler fallBack = null;

for (ICellGuiHandler ch : guiHandlers) {
if (ch.isSpecializedFor(is)) {
return ch;
}

if (fallBack == null) {
fallBack = ch;
}
}
return fallBack;
}

/**
* Returns the inventory for the provided storage cell item by querying all registered handlers.
*
Expand Down
59 changes: 0 additions & 59 deletions src/main/java/appeng/api/storage/cells/ICellGuiHandler.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
import appeng.menu.MenuOpener;
import appeng.menu.implementations.MEChestMenu;
import appeng.menu.locator.MenuLocators;
import appeng.menu.me.items.BasicCellChestMenu;
import appeng.util.inv.AppEngInternalInventory;
import appeng.util.inv.CombinedInternalInventory;
import appeng.util.inv.filter.IAEItemFilter;
Expand Down Expand Up @@ -538,11 +539,8 @@ public boolean openGui(Player p) {
var ch = StorageCells.getHandler(this.getCell());

if (ch != null) {
var chg = StorageCells.getGuiHandler(this.getCell());
if (chg != null) {
chg.openChestGui(p, this, ch, this.getCell());
return true;
}
MenuOpener.open(BasicCellChestMenu.TYPE, p, MenuLocators.forBlockEntity(this));
return true;
}
}

Expand Down

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions src/main/java/appeng/init/internal/InitStorageCells.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
import appeng.api.client.StorageCellModels;
import appeng.api.storage.StorageCells;
import appeng.core.definitions.AEItems;
import appeng.core.registries.cell.BasicFluidCellGuiHandler;
import appeng.core.registries.cell.BasicItemCellGuiHandler;
import appeng.me.cells.BasicCellHandler;
import appeng.me.cells.CreativeCellHandler;

Expand Down Expand Up @@ -76,8 +74,6 @@ private InitStorageCells() {
public static void init() {
StorageCells.addCellHandler(BasicCellHandler.INSTANCE);
StorageCells.addCellHandler(CreativeCellHandler.INSTANCE);
StorageCells.addCellGuiHandler(new BasicItemCellGuiHandler());
StorageCells.addCellGuiHandler(new BasicFluidCellGuiHandler());

StorageCellModels.registerModel(AEItems.ITEM_CELL_1K, MODEL_CELL_ITEMS_1K);
StorageCellModels.registerModel(AEItems.ITEM_CELL_4K, MODEL_CELL_ITEMS_4K);
Expand Down

0 comments on commit 7756c19

Please sign in to comment.