Refactored how cell state is exposed (#4422)

Replaced fuzzy ints with a well defined enum
Moved API related cell interfaces to a new subpackage
Introduced a new client helper method to register a cell texture for a storage channel
Added a method to obtain the storage channel for a drive or chest slot
Added a new cell state for cells with stored items but neither types nor completely full
This commit is contained in:
yueh
2020-06-22 22:18:41 +02:00
committed by GitHub
parent adf1bd0191
commit cb62d3a706
45 changed files with 224 additions and 118 deletions
@@ -24,8 +24,9 @@ import net.minecraftforge.items.IItemHandler;
import appeng.api.config.FuzzyMode;
import appeng.api.implementations.items.IStorageCell;
import appeng.api.storage.ICellInventory;
import appeng.api.storage.ISaveProvider;
import appeng.api.storage.cells.CellState;
import appeng.api.storage.cells.ICellInventory;
import appeng.api.storage.cells.ISaveProvider;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
@@ -289,13 +290,17 @@ public abstract class AbstractCellInventory<T extends IAEStack<T>> implements IC
}
@Override
public int getStatusForCell() {
public CellState getStatusForCell() {
if (this.getStoredItemTypes() == 0) {
return CellState.EMPTY;
}
if (this.canHoldNewItem()) {
return 1;
return CellState.NOT_EMPTY;
}
if (this.getRemainingItemCount() > 0) {
return 2;
return CellState.TYPES_FULL;
}
return 3;
return CellState.FULL;
}
}