fix robots not consuming energy and getting free energy when placed
This commit is contained in:
parent
a92af4664a
commit
ee681b19e7
11 changed files with 31 additions and 6 deletions
|
@ -116,7 +116,7 @@ public class EntityRobot extends EntityRobotBase implements
|
|||
|
||||
private NBTTagList stackRequestNBT;
|
||||
|
||||
private RFBattery battery = new RFBattery(MAX_ENERGY, MAX_ENERGY, 0);
|
||||
private RFBattery battery = new RFBattery(MAX_ENERGY, MAX_ENERGY, 100);
|
||||
|
||||
private boolean firstUpdateDone = false;
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ public class AIRobotBreak extends AIRobot {
|
|||
|
||||
@Override
|
||||
public int getEnergyCost() {
|
||||
return 20;
|
||||
return 30;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -33,4 +33,9 @@ public abstract class AIRobotCraftGeneric extends AIRobot {
|
|||
return crafted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyCost() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -155,4 +155,9 @@ public class AIRobotFetchItem extends AIRobot {
|
|||
terminate();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyCost() {
|
||||
return 20;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class AIRobotMain extends AIRobot {
|
|||
@Override
|
||||
public void preempt(AIRobot ai) {
|
||||
if (!(ai instanceof AIRobotRecharge)) {
|
||||
if (robot.getEnergy() < EntityRobotBase.MAX_ENERGY / 4.0) {
|
||||
if (robot.getEnergy() < EntityRobotBase.SAFETY_ENERGY) {
|
||||
startDelegateAI(new AIRobotRecharge(robot));
|
||||
} else if (overridingAI != null && ai != overridingAI) {
|
||||
startDelegateAI(overridingAI);
|
||||
|
|
|
@ -68,7 +68,7 @@ public class AIRobotPumpBlock extends AIRobot {
|
|||
|
||||
@Override
|
||||
public int getEnergyCost() {
|
||||
return 20;
|
||||
return 30;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -96,4 +96,10 @@ public class AIRobotSearchBlock extends AIRobot {
|
|||
public void unreserve() {
|
||||
blockScanner.unreserve(blockFound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyCost() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -73,4 +73,9 @@ public class AIRobotSearchEntity extends AIRobot {
|
|||
|
||||
terminate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyCost() {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,4 +75,9 @@ public class AIRobotSearchRandomGroundBlock extends AIRobot {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyCost() {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,6 +70,6 @@ public class AIRobotUseToolOnBlock extends AIRobot {
|
|||
|
||||
@Override
|
||||
public int getEnergyCost() {
|
||||
return 20;
|
||||
return 30;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -670,7 +670,6 @@ public class BlockGenericPipe extends BlockBuildCraft {
|
|||
|
||||
if (robot != null && robot.getRegistry() != null) {
|
||||
robot.setUniqueRobotId(robot.getRegistry().getNextRobotId());
|
||||
robot.getBattery().setEnergy(EntityRobotBase.MAX_ENERGY);
|
||||
|
||||
float px = x + 0.5F + rayTraceResult.sideHit.offsetX * 0.5F;
|
||||
float py = y + 0.5F + rayTraceResult.sideHit.offsetY * 0.5F;
|
||||
|
|
Loading…
Reference in a new issue