Skip to content

Commit a6e5269

Browse files
committed
Fix Import/Export Interfaces filters loading order
Fixes #86
1 parent 70f55be commit a6e5269

4 files changed

Lines changed: 18 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ The format is based on Keep a Changelog and this project adheres to Semantic Ver
1313
- Fix all Subnet Proxy issues (as if)
1414

1515

16+
## [0.6.5-beta] - 2026-07-08
17+
### Fixed
18+
- Fix Import/Export Interfaces loading filters from memory cards in the wrong order.
19+
20+
1621
## [0.6.4-beta5] - 2026-07-07
1722
### Fixed
1823
- Fix Subnet Proxy sometimes loading with an empty front-side view after a restart, by forcing a fresh relist when load-time front-grid churn invalidates the proxy's snapshot baseline before the final network is ready.

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ enable_junit_testing = false
1515
show_testing_output = false
1616

1717
# Mod Information
18-
mod_version = 0.6.4-beta5
18+
mod_version = 0.6.5-beta
1919
root_package = com.cells
2020
mod_id = cells
2121
mod_name = C.E.L.L.S

src/main/java/com/cells/blocks/interfacebase/AbstractResourceInterfaceLogic.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,8 +1209,11 @@ public void uploadSettings(NBTTagCompound compound, EntityPlayer player) {
12091209
protected void mergeFiltersFromNBT(NBTTagCompound data, String name, @Nullable EntityPlayer player) {
12101210
if (!data.hasKey(name)) return;
12111211

1212-
// Read source filters into temporary array
1212+
// Read source filters into temporary array in their original slot order,
1213+
// so we can merge them into the current filter inventory.
12131214
List<R> sourceFilters = new ArrayList<>();
1215+
for (int i = 0; i < FILTER_SLOTS; i++) sourceFilters.add(null);
1216+
12141217
NBTTagCompound filtersMap = data.getCompoundTag(name);
12151218
for (String key : filtersMap.getKeySet()) {
12161219
if (!key.startsWith("#")) continue;
@@ -1222,7 +1225,7 @@ protected void mergeFiltersFromNBT(NBTTagCompound data, String name, @Nullable E
12221225
NBTTagCompound filterTag = filtersMap.getCompoundTag(key);
12231226
if (filterTag.isEmpty()) continue;
12241227

1225-
sourceFilters.add(readResourceFromNBT(filterTag));
1228+
sourceFilters.set(slot, readResourceFromNBT(filterTag));
12261229
} catch (NumberFormatException ignored) {
12271230
}
12281231
}

src/main/java/com/cells/blocks/interfacebase/managers/InterfaceInventoryManager.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -729,13 +729,16 @@ public int findSlotByKey(@Nonnull K key) {
729729
* Merge filters from NBT (memory card upload), skipping duplicates.
730730
* Reports skipped filters to the player as a chat message.
731731
*
732-
* @param sourceFilters Array of source filters to merge (may contain nulls)
732+
* @param sourceFilters Source filters to merge, in source slot order (may contain nulls)
733733
* @param player Player to notify about skipped filters, or null
734734
*/
735735
public void mergeFilters(List<R> sourceFilters, @Nullable EntityPlayer player) {
736736
List<R> skippedFilters = new ArrayList<>();
737737

738-
for (R sourceFilter : sourceFilters) {
738+
int sourceSlotCount = Math.min(sourceFilters.size(), FILTER_SLOTS);
739+
740+
for (int sourceSlot = 0; sourceSlot < sourceSlotCount; sourceSlot++) {
741+
R sourceFilter = sourceFilters.get(sourceSlot);
739742
if (sourceFilter == null) continue;
740743

741744
K sourceKey = this.ops.createKey(sourceFilter);
@@ -744,8 +747,8 @@ public void mergeFilters(List<R> sourceFilters, @Nullable EntityPlayer player) {
744747
// Skip if filter already exists in target
745748
if (this.filterToSlotMap.containsKey(sourceKey)) continue;
746749

747-
// Find an empty slot
748-
int targetSlot = findEmptyFilterSlot();
750+
// Restore into the original slot when possible so per-slot settings stay aligned.
751+
int targetSlot = this.filters[sourceSlot] == null ? sourceSlot : findEmptyFilterSlot();
749752
if (targetSlot < 0) {
750753
skippedFilters.add(this.ops.copy(sourceFilter));
751754
continue;

0 commit comments

Comments
 (0)