fixed NPE when saving positions, close #1782
This commit is contained in:
parent
1c90496cde
commit
c0412cc831
1 changed files with 9 additions and 0 deletions
|
@ -40,6 +40,10 @@ public class Position {
|
||||||
y = cj;
|
y = cj;
|
||||||
z = ck;
|
z = ck;
|
||||||
orientation = corientation;
|
orientation = corientation;
|
||||||
|
|
||||||
|
if (orientation == null) {
|
||||||
|
orientation = ForgeDirection.UNKNOWN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Position(Position p) {
|
public Position(Position p) {
|
||||||
|
@ -57,6 +61,7 @@ public class Position {
|
||||||
x = tile.xCoord;
|
x = tile.xCoord;
|
||||||
y = tile.yCoord;
|
y = tile.yCoord;
|
||||||
z = tile.zCoord;
|
z = tile.zCoord;
|
||||||
|
orientation = ForgeDirection.UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void moveRight(double step) {
|
public void moveRight(double step) {
|
||||||
|
@ -127,6 +132,10 @@ public class Position {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||||
|
if (orientation == null) {
|
||||||
|
orientation = ForgeDirection.UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
nbttagcompound.setDouble("i", x);
|
nbttagcompound.setDouble("i", x);
|
||||||
nbttagcompound.setDouble("j", y);
|
nbttagcompound.setDouble("j", y);
|
||||||
nbttagcompound.setDouble("k", z);
|
nbttagcompound.setDouble("k", z);
|
||||||
|
|
Loading…
Reference in a new issue