-
Notifications
You must be signed in to change notification settings - Fork 497
/
TextureMatrix.java
44 lines (34 loc) · 999 Bytes
/
TextureMatrix.java
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
40
41
42
43
44
package buildcraft.transport.utils;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import net.minecraftforge.common.ForgeDirection;
public class TextureMatrix {
private final int[] _iconIndexes = new int[7];
private boolean dirty = false;
public int getTextureIndex(ForgeDirection direction) {
return _iconIndexes[direction.ordinal()];
}
public void setIconIndex(ForgeDirection direction, int value) {
if (_iconIndexes[direction.ordinal()] != value) {
_iconIndexes[direction.ordinal()] = value;
dirty = true;
}
}
public boolean isDirty() {
return dirty;
}
public void clean() {
dirty = false;
}
public void writeData(DataOutputStream data) throws IOException {
for (int i = 0; i < _iconIndexes.length; i++) {
data.writeByte(_iconIndexes[i]);
}
}
public void readData(DataInputStream data) throws IOException {
for (int i = 0; i < _iconIndexes.length; i++) {
_iconIndexes[i] = data.readByte();
}
}
}