aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/tileentities/machines/multi/purification/UVTreatmentLensCycle.java
blob: b834cdd0fe2fe034d266ed36f749257339f2fedb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package gregtech.common.tileentities.machines.multi.purification;

import java.util.List;

import net.minecraft.item.ItemStack;

public class UVTreatmentLensCycle {

    private final List<ItemStack> lenses;

    private int currentLens = 0;

    public UVTreatmentLensCycle(List<ItemStack> lenses) {
        this.lenses = lenses;
        if (lenses.isEmpty()) {
            throw new IllegalArgumentException("Supplied lens array may not be empty");
        }
    }

    public ItemStack current() {
        return lenses.get(currentLens);
    }

    public boolean advance() {
        if (currentLens < lenses.size() - 1) {
            currentLens = currentLens + 1;
            return true;
        }
        return false;
    }

    public void reset() {
        currentLens = 0;
    }

    public ItemStack first() {
        return lenses.get(0);
    }
}