fix robots dying while charging when they have 0 energy
This commit is contained in:
parent
99501d7b03
commit
0607faf12f
1 changed files with 13 additions and 1 deletions
|
@ -63,6 +63,7 @@ import buildcraft.core.utils.NBTUtils;
|
||||||
import buildcraft.core.utils.Utils;
|
import buildcraft.core.utils.Utils;
|
||||||
import buildcraft.robots.ai.AIRobotMain;
|
import buildcraft.robots.ai.AIRobotMain;
|
||||||
import buildcraft.robots.statements.ActionRobotWorkInArea;
|
import buildcraft.robots.statements.ActionRobotWorkInArea;
|
||||||
|
import buildcraft.transport.PipeTransportPower;
|
||||||
import buildcraft.transport.gates.ActionIterator;
|
import buildcraft.transport.gates.ActionIterator;
|
||||||
import buildcraft.transport.gates.StatementSlot;
|
import buildcraft.transport.gates.StatementSlot;
|
||||||
|
|
||||||
|
@ -315,7 +316,7 @@ public class EntityRobot extends EntityRobotBase implements
|
||||||
needsUpdate = true;
|
needsUpdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.battery.getEnergyStored() <= 0) {
|
if (this.battery.getEnergyStored() <= 0 && !linkedToChargeStation()) {
|
||||||
setDead();
|
setDead();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -324,6 +325,17 @@ public class EntityRobot extends EntityRobotBase implements
|
||||||
super.onEntityUpdate();
|
super.onEntityUpdate();
|
||||||
this.worldObj.theProfiler.endSection();
|
this.worldObj.theProfiler.endSection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean linkedToChargeStation() {
|
||||||
|
if (currentDockingStation == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(currentDockingStation.getPipe().pipe.transport instanceof PipeTransportPower)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private void spawnEnergyFX() {
|
private void spawnEnergyFX() {
|
||||||
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityRobotEnergyParticle(
|
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityRobotEnergyParticle(
|
||||||
|
|
Loading…
Reference in a new issue