blob: d3c8c491694ae8e68d2d4cf2c23785d9a59ed8b9 (
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.graphs;
import java.util.ArrayList;
import net.minecraft.tileentity.TileEntity;
public class Lock {
protected ArrayList<TileEntity> tiles = new ArrayList<>();
public void addTileEntity(TileEntity tileEntity) {
int i = contains(tileEntity);
if (i == -1) {
tiles.add(tileEntity);
}
}
public void removeTileEntity(TileEntity tileEntity) {
int i = contains(tileEntity);
if (i > -1) {
tiles.remove(i);
}
}
public boolean isLocked() {
return !tiles.isEmpty();
}
// i want to check for the exact object not equals
protected int contains(TileEntity tileEntity) {
for (int i = 0; i < tiles.size(); i++) {
if (tiles.get(i) == tileEntity) {
return i;
}
}
return -1;
}
}
|