68993534d9
Merge branch 'master' of https://bitbucket.org/AlgorithmX2/appliedenergistics2 into rv1 Conflicts: client/gui/widgets/GuiImgButton.java core/localization/ButtonToolTips.java
62 lines
1.3 KiB
Java
62 lines
1.3 KiB
Java
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<IAEItemStack>
|
|
{
|
|
|
|
final IItemContainer<IAEItemStack> backingStore;
|
|
final IItemContainer<IAEItemStack> overrides = AEApi.instance().storage().createItemList();
|
|
|
|
public ItemModList(IItemContainer<IAEItemStack> 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<IAEItemStack> findFuzzy(IAEItemStack input, FuzzyMode fuzzy)
|
|
{
|
|
Collection<IAEItemStack> overrrides = overrides.findFuzzy( input, fuzzy );
|
|
|
|
return overrrides;
|
|
}
|
|
|
|
@Override
|
|
public boolean isEmpty()
|
|
{
|
|
return overrides.isEmpty() && backingStore.isEmpty();
|
|
}
|
|
|
|
}
|