Further bugfixes.

This commit is contained in:
SpaceToad 2014-08-17 17:40:12 +02:00
parent d70184c3ae
commit 85db514e0a
2 changed files with 15 additions and 10 deletions

View file

@ -286,8 +286,6 @@ public class EntityRobot extends EntityRobotBase implements
linkedDockingStationIndex.z, linkedDockingStationIndex.z,
linkedDockingStationSide); linkedDockingStationSide);
linkedDockingStationIndex = null;
if (linkedDockingStation == null if (linkedDockingStation == null
|| linkedDockingStation.robotTaking() != this) { || linkedDockingStation.robotTaking() != this) {
// Error at load time, the expected linked stations is not // Error at load time, the expected linked stations is not
@ -298,15 +296,13 @@ public class EntityRobot extends EntityRobotBase implements
} }
} }
if (currentDockingStationIndex != null) { if (currentDockingStationIndex != null && currentDockingStation == null) {
currentDockingStation = (DockingStation) currentDockingStation = (DockingStation)
RobotRegistry.getRegistry(worldObj).getStation( RobotRegistry.getRegistry(worldObj).getStation(
currentDockingStationIndex.x, currentDockingStationIndex.x,
currentDockingStationIndex.y, currentDockingStationIndex.y,
currentDockingStationIndex.z, currentDockingStationIndex.z,
currentDockingStationSide); currentDockingStationSide);
currentDockingStationIndex = null;
} }
if (linkedDockingStation != null) { if (linkedDockingStation != null) {
@ -428,17 +424,17 @@ public class EntityRobot extends EntityRobotBase implements
NBTTagCompound linkedStationNBT = new NBTTagCompound(); NBTTagCompound linkedStationNBT = new NBTTagCompound();
NBTTagCompound linkedStationIndexNBT = new NBTTagCompound(); NBTTagCompound linkedStationIndexNBT = new NBTTagCompound();
linkedDockingStation.index().writeTo(linkedStationIndexNBT); linkedDockingStationIndex.writeTo(linkedStationIndexNBT);
linkedStationNBT.setTag("index", linkedStationIndexNBT); linkedStationNBT.setTag("index", linkedStationIndexNBT);
linkedStationNBT.setByte("side", (byte) linkedDockingStation.side().ordinal()); linkedStationNBT.setByte("side", (byte) linkedDockingStationSide.ordinal());
nbt.setTag("linkedStation", linkedStationNBT); nbt.setTag("linkedStation", linkedStationNBT);
if (currentDockingStation != null) { if (currentDockingStationIndex != null) {
NBTTagCompound currentStationNBT = new NBTTagCompound(); NBTTagCompound currentStationNBT = new NBTTagCompound();
NBTTagCompound currentStationIndexNBT = new NBTTagCompound(); NBTTagCompound currentStationIndexNBT = new NBTTagCompound();
currentDockingStation.index().writeTo(currentStationIndexNBT); currentDockingStationIndex.writeTo(currentStationIndexNBT);
currentStationNBT.setTag("index", currentStationIndexNBT); currentStationNBT.setTag("index", currentStationIndexNBT);
currentStationNBT.setByte("side", (byte) currentDockingStation.side().ordinal()); currentStationNBT.setByte("side", (byte) currentDockingStationSide.ordinal());
nbt.setTag("currentStation", currentStationNBT); nbt.setTag("currentStation", currentStationNBT);
} }
@ -548,6 +544,9 @@ public class EntityRobot extends EntityRobotBase implements
currentDockingStation.side.offsetX, currentDockingStation.side.offsetX,
currentDockingStation.side.offsetY, currentDockingStation.side.offsetY,
currentDockingStation.side.offsetZ); currentDockingStation.side.offsetZ);
currentDockingStationIndex = currentDockingStation.index();
currentDockingStationSide = currentDockingStation.side();
} }
@Override @Override
@ -557,6 +556,9 @@ public class EntityRobot extends EntityRobotBase implements
currentDockingStation = null; currentDockingStation = null;
setSteamDirection(0, -1, 0); setSteamDirection(0, -1, 0);
currentDockingStationIndex = null;
currentDockingStationSide = null;
} }
} }
@ -573,6 +575,8 @@ public class EntityRobot extends EntityRobotBase implements
} }
linkedDockingStation = station; linkedDockingStation = station;
linkedDockingStationIndex = linkedDockingStation.index();
linkedDockingStationSide = linkedDockingStation.side();
} }
@Override @Override

View file

@ -82,6 +82,7 @@ public class BoardRobotDelivery extends RedstoneBoardRobot {
} }
} else if (ai instanceof AIRobotDeliverRequested) { } else if (ai instanceof AIRobotDeliverRequested) {
robot.releaseResources(); robot.releaseResources();
currentRequest = null;
} }
} }