Skip to content

Fix magnet filter only checking first configured slot#410

Merged
UltraProdigy merged 1 commit intoGTNewHorizons:masterfrom
clawdbot-silly-waddle:fix/magnet-filter-all-slots
Mar 7, 2026
Merged

Fix magnet filter only checking first configured slot#410
UltraProdigy merged 1 commit intoGTNewHorizons:masterfrom
clawdbot-silly-waddle:fix/magnet-filter-all-slots

Conversation

@clawdbot-silly-waddle
Copy link

@clawdbot-silly-waddle clawdbot-silly-waddle commented Mar 6, 2026

Bug

The magnet filter's isItemFiltered method only respected the first configured slot. Items configured in slots 2-27 were ignored.

Root cause: Each comparison branch inside the for loop used return <condition> instead of storing the result. When the first non-null slot didn't match, the method returned false immediately, never checking subsequent slots.

Reproduction: Configure the magnet filter whitelist with two different items (e.g. eggs in slot 0, feathers in slot 1). Only the item in slot 0 gets filtered; the item in slot 1 is ignored.

Fix

Store each comparison result in a local variable and only return true on match, allowing the loop to continue to subsequent slots on non-match.

Fixes GTNewHorizons/GT-New-Horizons-Modpack#23776
Fixes GTNewHorizons/GT-New-Horizons-Modpack#23654

The isItemFiltered method returned the comparison result on the first
non-null filter slot, exiting the loop even on non-match. Items in
slots beyond the first were never checked.

Store the comparison in a local variable and only return true on match,
allowing the loop to continue to subsequent filter slots.

Fixes GTNewHorizons/GT-New-Horizons-Modpack#23776

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@clawdbot-silly-waddle clawdbot-silly-waddle marked this pull request as draft March 6, 2026 23:49
@clawdbot-silly-waddle clawdbot-silly-waddle marked this pull request as ready for review March 7, 2026 00:14
@UltraProdigy UltraProdigy enabled auto-merge (squash) March 7, 2026 04:21
@UltraProdigy UltraProdigy merged commit 1e98b07 into GTNewHorizons:master Mar 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AE2 Magnet Filter only respects the first slot in the configuration UI Universal Wireless Terminal Magnet FIlter

3 participants