Applied-Energistics-2-tiler.../core/features/registries/SpecialComparisonRegistry.java

42 lines
926 B
Java
Raw Normal View History

package appeng.core.features.registries;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.item.ItemStack;
2014-09-20 22:27:56 +02:00
import appeng.api.features.IItemComparisonProvider;
import appeng.api.features.IItemComparison;
import appeng.api.features.ISpecialComparisonRegistry;
public class SpecialComparisonRegistry implements ISpecialComparisonRegistry
{
2014-09-20 22:27:56 +02:00
private List<IItemComparisonProvider> CompRegistry;
public SpecialComparisonRegistry() {
2014-09-20 22:27:56 +02:00
CompRegistry = new ArrayList<IItemComparisonProvider>();
}
@Override
public IItemComparison getSpecialComparion(ItemStack stack)
{
2014-09-20 22:27:56 +02:00
for (IItemComparisonProvider i : CompRegistry)
{
IItemComparison comp = i.getComparison( stack );
if ( comp != null )
{
return comp;
}
}
return null;
}
@Override
2014-09-20 22:27:56 +02:00
public void addComparisonProvider(IItemComparisonProvider prov)
{
CompRegistry.add( prov );
}
}