fix invalid board IDs, add some startup time for all robot/world data to initialize

This commit is contained in:
asiekierka 2015-04-27 22:44:28 +02:00
parent 36f477a1ce
commit 5ab94d7ecb
3 changed files with 17 additions and 7 deletions

View file

@ -100,6 +100,7 @@ public class EntityRobot extends EntityRobotBase implements
private boolean needsUpdate = false;
private ItemStack[] inv = new ItemStack[4];
private FluidStack tank;
private int startupCooldown = 100;
private int maxFluid = FluidContainerRegistry.BUCKET_VOLUME * 4;
private ResourceLocation texture;
@ -262,6 +263,10 @@ public class EntityRobot extends EntityRobotBase implements
ticksCharging--;
}
if (startupCooldown > 0) {
startupCooldown--;
}
if (!worldObj.isRemote) {
// The client-side sleep indicator should also display if the robot is charging.
// To not break gates and other things checking for sleep, this is done here.
@ -298,7 +303,7 @@ public class EntityRobot extends EntityRobotBase implements
if (linkedDockingStation == null
|| linkedDockingStation.robotTaking() != this) {
if (!(mainAI.getDelegateAI() instanceof AIRobotShutdown)) {
if (!(mainAI.getDelegateAI() instanceof AIRobotShutdown) && startupCooldown <= 0) {
mainAI.startDelegateAI(new AIRobotShutdown(this));
}
}
@ -341,10 +346,15 @@ public class EntityRobot extends EntityRobotBase implements
@SideOnly(Side.CLIENT)
private void spawnEnergyFX() {
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityRobotEnergyParticle(
worldObj,
posX + steamDx * 0.25, posY + steamDy * 0.25, posZ + steamDz * 0.25,
steamDx * 0.05, steamDy * 0.05, steamDz * 0.05,
energySpendPerCycle * 0.075F < 1 ? 1 : energySpendPerCycle * 0.075F));
worldObj,
posX + steamDx * 0.25, posY + steamDy * 0.25, posZ + steamDz * 0.25,
steamDx * 0.05, steamDy * 0.05, steamDz * 0.05,
energySpendPerCycle * 0.075F < 1 ? 1 : energySpendPerCycle * 0.075F));
}
@Override
public boolean canShutdown() {
return startupCooldown <= 0;
}
public void setRegularBoundingBox() {

View file

@ -28,7 +28,7 @@ public class AIRobotMain extends AIRobot {
@Override
public void preempt(AIRobot ai) {
if (robot.getEnergy() <= EntityRobotBase.SHUTDOWN_ENERGY
if (robot.getEnergy() <= EntityRobotBase.SHUTDOWN_ENERGY && robot.canShutdown()
&& (robot.getDockingStation() == null || !robot.getDockingStation().providesPower())) {
if (!(ai instanceof AIRobotShutdown)) {
startDelegateAI(new AIRobotShutdown(robot));

View file

@ -50,7 +50,7 @@ public class BCBoardNBT extends RedstoneBoardRobotNBT {
@Override
public String getID() {
return "buildcraft:" + id;
return id;
}
@Override