package appeng.util.item; import java.util.Collection; import appeng.api.AEApi; import appeng.api.config.FuzzyMode; import appeng.api.storage.data.IAEItemStack; import appeng.api.storage.data.IItemContainer; public class ItemModList implements IItemContainer { final IItemContainer backingStore; final IItemContainer overrides = AEApi.instance().storage().createItemList(); public ItemModList(IItemContainer backend) { backingStore = backend; } @Override public void add(IAEItemStack option) { IAEItemStack over = overrides.findPrecise( option ); if ( over == null ) { over = backingStore.findPrecise( option ); if ( over == null ) overrides.add( option ); else { option.add( over ); overrides.add( option ); } } else overrides.add( option ); } @Override public IAEItemStack findPrecise(IAEItemStack i) { IAEItemStack over = overrides.findPrecise( i ); if ( over == null ) return backingStore.findPrecise( i ); return over; } @Override public Collection findFuzzy(IAEItemStack input, FuzzyMode fuzzy) { Collection overrrides = overrides.findFuzzy( input, fuzzy ); return overrrides; } @Override public boolean isEmpty() { return overrides.isEmpty() && backingStore.isEmpty(); } }