aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/util/GT_BlockSet.java
blob: 1d13afd05695a869f49089a74a44fbd46b580c16 (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.api.util;

import net.minecraft.block.Block;

public class GT_BlockSet {

    private final GT_BlockMap<Object> backing = new GT_BlockMap<>();

    public boolean add(Block block, byte meta) {
        return backing.put(block, meta, this) != this;
    }

    public boolean contains(Block block, byte meta) {
        return backing.get(block, meta) == this;
    }

    public boolean remove(Block block, byte meta) {
        return backing.remove(block, meta) == this;
    }

    public int size() {
        return backing.size();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        GT_BlockSet that = (GT_BlockSet) o;

        return backing.equals(that.backing);
    }

    @Override
    public int hashCode() {
        return backing.hashCode();
    }
}