pistonStage = 2;
TileEntity tile = WorldPlugin.getTileEntityOnSide(worldObj, xCoord, yCoord, zCoord, direction);
if (EngineTools.isPoweredTile(tile, direction.getOpposite())) {
IPowerReceptor receptor = (IPowerReceptor) tile;
PowerReceiver recProv = receptor.getPowerReceiver(direction.getOpposite());
double extracted = extractEnergy(recProv.getMinEnergyReceived(), recProv.getMaxEnergyReceived(), true);
if (extracted > 0)
recProv.receiveEnergy(PowerHandler.Type.ENGINE, extracted, direction.getOpposite());
}
} else if (pistonProgress >= 1) {
pistonProgress = 0;
pistonStage = 0;
}
} else if (powered) {
TileEntity tile = WorldPlugin.getTileEntityOnSide(worldObj, xCoord, yCoord, zCoord, direction);
if (EngineTools.isPoweredTile(tile, direction.getOpposite())) {
IPowerReceptor receptor = (IPowerReceptor) tile;
PowerReceiver recProv = receptor.getPowerReceiver(direction.getOpposite());
if (extractEnergy(recProv.getMinEnergyReceived(), recProv.getMaxEnergyReceived(), false) > 0) {
pistonStage = 1;
setActive(true);
} else