mirror of
https://github.com/GTNewHorizons/Applied-Energistics-2-Unofficial.git
synced 2026-10-25 20:22:23 +00:00
Exclude void cells from storage type statistics (#1648)
This commit is contained in:
1 parent
4dcc31e510
commit
59c002bc5a
2 files changed
+37
-6
No files matched your search
@@ -22,12 +22,15 @@ import com.gtnewhorizons.horizonqa.api.annotation.GameTest;
|
||||
import com.gtnewhorizons.horizonqa.api.annotation.GameTestHolder;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.storage.ICellCacheRegistry;
|
||||
import appeng.api.storage.ICellInventory;
|
||||
import appeng.api.storage.ICellInventoryHandler;
|
||||
import appeng.api.storage.ICellWorkbenchItem;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.me.cache.GridStorageCache;
|
||||
import appeng.tile.inventory.IAEStackInventory;
|
||||
import appeng.tile.networking.TileController;
|
||||
import appeng.tile.storage.TileChest;
|
||||
@@ -60,6 +63,28 @@ public class DriveAndCellTests {
|
||||
.thenSucceed();
|
||||
}
|
||||
|
||||
@GameTest(template = "drive_cells", timeoutTicks = 100)
|
||||
public static void voidCellIsDisplayedWithoutAddingTypes(GameTestHelper helper) {
|
||||
TileController controller = getController(helper);
|
||||
TileDrive drive = getDrive(helper);
|
||||
ItemStack storageCell = cell1k();
|
||||
ItemStack voidCell = AEApi.instance().definitions().items().cellVoid().maybeStack(1).get();
|
||||
long expectedTypes = ((ICellCacheRegistry) itemInventory(helper, storageCell)).getTotalTypes();
|
||||
|
||||
helper.startSequence().thenWaitUntil("wait for drive network activation", 40, () -> {
|
||||
assertActive(helper, controller.getProxy(), "Controller grid proxy should become active");
|
||||
assertActive(helper, drive.getProxy(), "Drive grid proxy should become active");
|
||||
}).thenExecute("insert storage and void cells", () -> {
|
||||
helper.setSlot(DRIVE_LABEL, 0, storageCell);
|
||||
helper.setSlot(DRIVE_LABEL, 1, voidCell);
|
||||
}).thenWaitUntil("wait for network cell statistics", 40, () -> {
|
||||
GridStorageCache storageGrid = controller.getProxy().getNode().getGrid().getCache(IStorageGrid.class);
|
||||
helper.assertEquals(expectedTypes, storageGrid.getItemTypesTotal(), "Void cell should not add item types");
|
||||
helper.assertEquals(2L, storageGrid.getItemCellCount(), "Void cell should add to the cell count");
|
||||
helper.assertTrue(storageGrid.getItemCells().containsKey(voidCell), "Void cell should remain in cell list");
|
||||
}).thenSucceed();
|
||||
}
|
||||
|
||||
// A partitioned cell should accept only stacks matching its configured partition list.
|
||||
@GameTest(template = "drive_cells", timeoutTicks = 100)
|
||||
public static void partitionedCellRejectsUnconfiguredItem(GameTestHelper helper) {
|
||||
|
||||
+12
-6
@@ -437,14 +437,20 @@ public class GridStorageCache implements IStorageGrid {
|
||||
}
|
||||
|
||||
private void updateCellsStatusFromRegistry(final ICellCacheRegistry iccr, final ItemStack newCellStack) {
|
||||
final long reportedTotalTypes = iccr.getTotalTypes();
|
||||
// Void cells are the only cells with a maximum type count; revisit this if a finite cell ever uses one.
|
||||
final boolean isVoidCell = reportedTotalTypes == Integer.MAX_VALUE || reportedTotalTypes == Long.MAX_VALUE;
|
||||
final long totalTypes = isVoidCell ? 0 : reportedTotalTypes;
|
||||
final long usedTypes = isVoidCell ? 0 : iccr.getUsedTypes();
|
||||
|
||||
switch (iccr.getCellType()) {
|
||||
case ITEM -> {
|
||||
this.updateItemCellStatus(
|
||||
iccr.getTotalBytes(),
|
||||
iccr.getUsedBytes(),
|
||||
iccr.getCellStatus(),
|
||||
iccr.getTotalTypes(),
|
||||
iccr.getUsedTypes());
|
||||
totalTypes,
|
||||
usedTypes);
|
||||
this.putItemStackIntoMap(itemCells, newCellStack, iccr.getCellStatus());
|
||||
}
|
||||
case FLUID -> {
|
||||
@@ -452,8 +458,8 @@ public class GridStorageCache implements IStorageGrid {
|
||||
iccr.getTotalBytes(),
|
||||
iccr.getUsedBytes(),
|
||||
iccr.getCellStatus(),
|
||||
iccr.getTotalTypes(),
|
||||
iccr.getUsedTypes());
|
||||
totalTypes,
|
||||
usedTypes);
|
||||
this.putItemStackIntoMap(fluidCells, newCellStack, iccr.getCellStatus());
|
||||
}
|
||||
case ESSENTIA -> {
|
||||
@@ -461,8 +467,8 @@ public class GridStorageCache implements IStorageGrid {
|
||||
iccr.getTotalBytes(),
|
||||
iccr.getUsedBytes(),
|
||||
iccr.getCellStatus(),
|
||||
iccr.getTotalTypes(),
|
||||
iccr.getUsedTypes());
|
||||
totalTypes,
|
||||
usedTypes);
|
||||
this.putItemStackIntoMap(essentiaCells, newCellStack, iccr.getCellStatus());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user