copy part of robot chunkload fix from the 6.4.x branch

This commit is contained in:
Hea3veN 2015-06-01 21:22:44 -03:00
parent f8290b947c
commit 8614d2618e

View file

@ -311,11 +311,17 @@ public class EntityRobot extends EntityRobotBase implements
linkedDockingStationSide);
}
if (linkedDockingStation == null
|| linkedDockingStation.robotTaking() != this) {
if (!(mainAI.getDelegateAI() instanceof AIRobotShutdown)) {
BCLog.logger.info("Shutting down robot " + this.toString() + " - no docking station");
mainAI.startDelegateAI(new AIRobotShutdown(this));
if (linkedDockingStation == null) {
shutdown("no docking station");
} else {
if (linkedDockingStation.robotTaking() != this) {
if (linkedDockingStation.robotIdTaking() == robotId) {
BCLog.logger.warn("A robot entity was not properly unloaded");
linkedDockingStation.invalidateRobotTakingEntity();
}
if (linkedDockingStation.robotTaking() != this) {
shutdown("wrong docking station");
}
}
}
}
@ -385,6 +391,13 @@ public class EntityRobot extends EntityRobotBase implements
boundingBox.maxZ = posZ;
}
private void shutdown(String reason) {
if (!(mainAI.getDelegateAI() instanceof AIRobotShutdown)) {
BCLog.logger.info("Shutting down robot " + this.toString() + " - " + reason);
mainAI.startDelegateAI(new AIRobotShutdown(this));
}
}
private void iterateBehaviorDocked() {
motionX = 0F;
motionY = 0F;