Fix Laser's hasWork trigger

This commit is contained in:
CovertJaguar 2013-08-29 04:51:28 -07:00
parent 54e7e372ec
commit 45e73c28b1

View file

@ -23,6 +23,7 @@ import buildcraft.core.TileBuildCraft;
import buildcraft.core.proxy.CoreProxy;
import buildcraft.core.triggers.ActionMachineControl;
import java.util.LinkedList;
import java.util.List;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
@ -58,12 +59,6 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor, IAction
if (!CoreProxy.proxy.isSimulating(worldObj))
return;
// Disable the laser and do nothing if no energy is available.
if (powerHandler.getEnergyStored() == 0) {
removeLaser();
return;
}
// If a gate disabled us, remove laser and do nothing.
if (lastMode == ActionMachineControl.Mode.Off) {
removeLaser();
@ -83,6 +78,12 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor, IAction
return;
}
// Disable the laser and do nothing if no energy is available.
if (powerHandler.getEnergyStored() == 0) {
removeLaser();
return;
}
// We have a table and can work, so we create a laser if
// necessary.
if (laser == null) {
@ -101,19 +102,19 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor, IAction
if (laser != null) {
laser.pushPower(power);
}
onPowerSent(power);
sendNetworkUpdate();
}
protected float getMaxPowerSent(){
protected float getMaxPowerSent() {
return 4;
}
protected void onPowerSent(float power) {
}
protected boolean canFindTable() {
return searchTracker.markTimeIfDelay(worldObj, nextLaserSearch);
}
@ -162,7 +163,7 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor, IAction
break;
}
LinkedList<BlockIndex> targets = new LinkedList<BlockIndex>();
List<BlockIndex> targets = new LinkedList<BlockIndex>();
for (int x = minX; x <= maxX; ++x) {
for (int y = minY; y <= maxY; ++y) {
@ -181,7 +182,7 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor, IAction
}
}
if (targets.size() == 0)
if (targets.isEmpty())
return;
BlockIndex b = targets.get(worldObj.rand.nextInt(targets.size()));
@ -280,7 +281,7 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor, IAction
@Override
public boolean isActive() {
return laser != null;
return isValidTable();
}
@Override