Fix Laser's hasWork trigger
This commit is contained in:
parent
54e7e372ec
commit
45e73c28b1
1 changed files with 13 additions and 12 deletions
|
@ -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) {
|
||||
|
@ -107,7 +108,7 @@ public class TileLaser extends TileBuildCraft implements IPowerReceptor, IAction
|
|||
sendNetworkUpdate();
|
||||
}
|
||||
|
||||
protected float getMaxPowerSent(){
|
||||
protected float getMaxPowerSent() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue