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