Minor cleanup

This commit is contained in:
aidancbrady committed 2017-07-23 18:02:49 -07:00
1 parent 51f6ad5ed3
commit 7db697213c
1 file changed
+18 -11
@@ -5,15 +5,15 @@ import net.minecraft.util.EnumFacing;
import java.util.Observable;
import java.util.Observer;
public class SideConfig {
public class SideConfig
{
private byte[] directions = new byte[EnumFacing.VALUES.length];
private Observable observable = new Observable();
public SideConfig()
{
}
public SideConfig() {}
public SideConfig(byte[] b) {
public SideConfig(byte[] b)
{
this(b[0], b[1], b[2], b[3], b[4], b[5]);
assert b.length == EnumFacing.VALUES.length;
}
@@ -23,34 +23,41 @@ public class SideConfig {
setDirections(d, u, n, s, w, e);
}
public void setDirections(byte d, byte u, byte n, byte s, byte w, byte e) {
public void setDirections(byte d, byte u, byte n, byte s, byte w, byte e)
{
directions[0] = d;
directions[1] = u;
directions[2] = n;
directions[3] = s;
directions[4] = w;
directions[5] = e;
observable.notifyObservers(this);
}
public byte get(EnumFacing f) {
public byte get(EnumFacing f)
{
return directions[f.ordinal()];
}
public byte[] asByteArray() {
public byte[] asByteArray()
{
return directions;
}
public void set(EnumFacing f, byte value) {
public void set(EnumFacing f, byte value)
{
directions[f.ordinal()] = value;
observable.notifyObservers(this);
}
public void addObserver(Observer o) {
public void addObserver(Observer o)
{
observable.addObserver(o);
}
public void deleteObserver(Observer o) {
public void deleteObserver(Observer o)
{
observable.deleteObserver(o);
}
}